siml.services package

Subpackages

Submodules

siml.services.environment module

class siml.services.environment.ModelEnvironmentSetting(gpu_id: int, seed: int, data_parallel: bool, model_parallel: bool, time_series: bool)

Bases: object

This class has information of model environments. In the future, this class is deprecated and integrated to MainSetting

data_parallel: bool
get_device() str
get_output_device() str
property gpu_count: int
gpu_id: int
model_parallel: bool
seed: int
set_seed() None
time_series: bool

siml.services.model_builder module

class siml.services.model_builder.ModelBuilder(model_setting: ModelSetting, trainer_setting: TrainerSetting, env_setting: ModelEnvironmentSetting)

Bases: object

create_initialized() Network

Create initialized network object

Returns:

network object

Return type:

networks.Network

create_loaded(checkpoint_file: Path, decrypt_key: bytes | None = None) Network

Create network object loaded from checkpoint file

Parameters:
  • checkpoint_file (pathlib.Path) – Path to checkpoint file

  • decrypt_key (Optional[bytes], optional) – decrpt byte key, by default None

Returns:

network object

Return type:

networks.Network

property state_dict_strict: bool

siml.services.model_selector module

class siml.services.model_selector.BestModelSelector

Bases: IModelSelector

static select_model(dir_path: Path, **kwards) ISimlCheckpointFile
class siml.services.model_selector.DeployedModelSelector

Bases: IModelSelector

static select_model(dir_path: Path, **kwards) ISimlCheckpointFile
class siml.services.model_selector.IModelSelector

Bases: object

abstract static select_model(dir_path: Path, **kwards) ISimlCheckpointFile
class siml.services.model_selector.LatestModelSelector

Bases: IModelSelector

static select_model(dir_path: Path, **kwards) ISimlCheckpointFile
class siml.services.model_selector.ModelSelectorBuilder

Bases: object

static create(selection_name: str) IModelSelector
class siml.services.model_selector.SpecifiedModelSelector

Bases: IModelSelector

static select_model(dir_path: Path, *, infer_epoch: int, **kwards) ISimlCheckpointFile
class siml.services.model_selector.TrainBestModelSelector

Bases: IModelSelector

static select_model(dir_path: Path, **kwards) ISimlCheckpointFile

siml.services.path_rules module

class siml.services.path_rules.SimlPathRules(_type_to_name: mappingproxy = mappingproxy({<DirectoryType.RAW: 0>: 'raw', <DirectoryType.INTERIM: 1>: 'interim', <DirectoryType.PREPROCESSED: 2>: 'preprocessed'}))

Bases: object

common_parent(directory_1: Path, directory_2: Path) Path

Search common parent directory

Parameters:
  • directory_1 (pathlib.Path) –

  • directory_2 (pathlib.Path) –

Returns:

common_parent – Path to common parent directory

Return type:

pathlib.Path

detect_directory_type(data_directory: Path) DirectoryType | None
determine_output_directory(data_directory: Path, output_base_directory: Path, *, allowed_type: DirectoryType | None = None) Path
Determine output directory by replacing a string

in the input_directory according to directory type of data directory.

Parameters:
  • input_directory (pathlib.Path) – Input directory path.

  • output_base_directory (pathlib.Path) – Output base directory path. The output directry name is under that directory.

Returns:

output_directory – Detemined output directory path.

Return type:

pathlib.Path

Examples

input_direcotry = “./aaa/bbb/interim/ddd” output_base_directory = “./aaa/ccc”

output_directory = “./aaa/ccc/bbb/ddd”

determine_write_simulation_case_dir(data_directory: Path, write_simulation_base: Path | None = None) Path | None
is_target_directory_type(data_directory: Path, dir_type: DirectoryType) bool
switch_directory_type(directory: Path, dir_type_to: DirectoryType) Path

Module contents