OnnxExporter
python
OnnxExporter(game_configuration: GameConfiguration, model_configuration: ModelConfiguration, training_configuration: TrainingConfiguration, create_module_and_observation_space: Callable[[int | None], tuple[torch.nn.Module, Box]], export_lock: Callable[[], contextlib.AbstractContextManager]) -> NoneExports a checkpointed model to ONNX.
export is verbose, for the standalone Experiment.export() path. export_quiet additionally holds the caller-provided export lock and suppresses noisy third-party logging, for use from the background checkpoint-write path, which may run concurrently with learner updates.
Initialize the exporter.
Parameters:
game_configuration(GameConfiguration) – The experiment's game configuration, embedded as ONNX metadata.model_configuration(ModelConfiguration) – The experiment's model configuration, embedded as ONNX metadata.training_configuration(TrainingConfiguration) – The experiment's training configuration, embedded as ONNX metadata.create_module_and_observation_space(Callable[[int | None], tuple[Module, Box]]) – Builds the exportable module and its observation space for a given checkpoint number (or the live model whenNone).export_lock(Callable[[], AbstractContextManager]) – The lock to hold during a quiet (background) export.
Methods
export
python
export(output_path: str | PathLike, *, checkpoint_number: int | None = None) -> PathExport the model to ONNX, logging progress.
Parameters:
output_path(str | PathLike) – Where to write the ONNX file.checkpoint_number(int | None) – The checkpoint to export, orNoneto export the live model.
Returns:
Path– The output path.
export_quiet
python
export_quiet(output_path: str | PathLike, *, checkpoint_number: int | None) -> NoneExport the model to ONNX while holding the export lock, suppressing routine logging.
Parameters:
output_path(str | PathLike) – Where to write the ONNX file.checkpoint_number(int | None) – The checkpoint to export.