openrl.selfplay.callbacks package¶
Submodules¶
openrl.selfplay.callbacks.base_callback module¶
openrl.selfplay.callbacks.selfplay_api module¶
openrl.selfplay.callbacks.selfplay_callback module¶
- class openrl.selfplay.callbacks.selfplay_callback.SelfplayCallback(save_freq: int, opponent_pool_path: Union[str, pathlib.Path], api_address: str, name_prefix: str = 'opponent', save_replay_buffer: bool = False, opponent_template: Optional[str] = None, clear_past_opponents: bool = False, copy_script_file: bool = False, verbose: int = 0)[源代码]¶
基类:
openrl.selfplay.callbacks.base_callback.BaseSelfplayCallbackCallback for saving a model every
save_freqcalls toenv.step(). By default, it only saves model checkpoints, you need to passsave_replay_buffer=Trueto save replay buffer checkpoints.警告
When using multiple environments, each call to
env.step()will effectively correspond ton_envssteps. To account for that, you can usesave_freq = max(save_freq // n_envs, 1)- 参数
save_freq -- Save checkpoints every
save_freqcall of the callback.opponent_pool_path -- Path to the folder where the model will be saved.
name_prefix -- Common prefix to the saved models
save_replay_buffer -- Save the model replay buffer
verbose -- Verbosity level: 0 for no output, 2 for indicating when saving model checkpoint
- get_opponent_path(checkpoint_type: str = '', extension: str = '') pathlib.Path[源代码]¶
Helper to get checkpoint path for each type of checkpoint.
- 参数
checkpoint_type -- empty for the model, "replay_buffer_" for the other checkpoints.
extension -- Checkpoint file extension (zip for model, pkl for others)
- 返回
Path to the checkpoint