trinity.manager

Subpackages

Submodules

trinity.manager.config_manager module

class trinity.manager.config_manager.ConfigManager[source]

Bases: object

__init__()[source]
reset_session_state()[source]
maintain_session_state()[source]
get_configs(*config_names: str, columns_spec: List[int] | None = None)[source]
beginner_mode()[source]
expert_mode()[source]
generate_config()[source]
run_config(parent, yaml_config: str) None[source]

trinity.manager.manager module

Data manager.

class trinity.manager.manager.CacheManager(config: Config, check_config: bool = False)[source]

Bases: object

A Manager class for managing the cache dir.

__init__(config: Config, check_config: bool = False)[source]
save_explorer(current_task_index: int, current_step: int) None[source]
load_explorer() dict[source]
save_trainer(current_step: int) None[source]
load_trainer() dict[source]

Module contents

class trinity.manager.Trainer(config: Config)[source]

Bases: object

Consume the experience and train the model.

__init__(config: Config) None[source]
prepare() None[source]

Prepare the trainer.

train() str[source]

Train the model.

train_step() bool[source]

Train one step.

Returns:

Whether to continue training.

Return type:

bool

need_sync() bool[source]

Whether to sync the model weight.

sync_weight() None[source]

Sync the model weight.

flush_log(step: int) None[source]

Flush the log of the current step.

shutdown() None[source]
class trinity.manager.TrainEngineWrapper[source]

Bases: ABC

A wrapper class to wrap various training engines.

abstract prepare() None[source]

Do some preparation before training started.

abstract property train_step_num: int

Get the current training step number.

abstract train_step() bool[source]

Training.

abstract save_checkpoint() None[source]

Save the checkpoint.

abstract sync_weight() None[source]

Sync the model weight.

abstract shutdown() None[source]

Shutdown the engine.

trinity.manager.get_trainer_wrapper(config: Config) TrainEngineWrapper[source]

Get a trainer wrapper.