pytorch_trainer¶
Module pytorch_multi_process_trainer. Specifies a trainer for PyTorch-based models.
- pytorch_trainer.worker(worker_idx: int, worker_model: Module, params: dir)¶
Executes the process work
- Parameters
worker_idx (The id of the worker) –
worker_model (The model the worker is using) –
params (Parameters needed) –
- class pytorch_trainer.PyTorchTrainerConfig(n_procs: int = 1, n_episodes: int = 100)¶
Configuration for PyTorchMultiProcessTrainer
- class pytorch_trainer.PyTorchTrainer(env: Env, agent: Agent, config: PyTorchTrainerConfig)¶
The class PyTorchMultiProcessTrainer. Trainer for multiprocessing with PyTorch
- __init__(env: Env, agent: Agent, config: PyTorchTrainerConfig) None ¶
Constructor. Initialize a trainer by passing the training environment instance the agent to train and configuration dictionary
- Parameters
agent (The agent to train) –
config (Configuration parameters for the trainer) –
- actions_after_episode_ends(env: Env, episode_idx: int, **options) None ¶
Any actions after the training episode ends
- Parameters
env (The environment to train on) –
episode_idx (The training episode index) –
options (Any options passed by the client code) –
- Return type
None
- actions_before_episode_begins(env: Env, episode_idx: int, **options) None ¶
Perform any actions necessary before the training begins
- Parameters
env (The environment to train on) –
episode_idx (The training episode index) –
options (Any options passed by the client code) –
- Return type
None
- actions_before_training() None ¶
Any actions to perform before training begins
- Return type
None
- avg_distortion() array ¶
Returns the average reward per episode :return:
- avg_rewards() array ¶
Returns the average reward per episode :return: