Saving and Loading#
navground.learning.io
- Parameters:
path (PathLike)
- Return type:
Export a model using
export_policy_as_behavior()
- Parameters:
model (BaseAlgorithm | BaseILAlgorithm) – The model
path (PathLike) – The directory where to save the files
- Return type:
None
Export a policy (using
navground.learning.onnx.export()
) together with the YAML representation of the behavior and sensor to use it.The behavior and sensor refer to an agent at a given index in the environment. If they cannot be retrieved, the related files will not be saved.
- Parameters:
path (PathLike) – The directory where to save the files
policy (BasePolicy | None) – The policy
env (BaseEnv | BaseParallelEnv | None) – The environment.
index (int | None) – The index of the agent in the environment. If not provided, selects one of the possible agents.
- Return type:
None
Load behavior and sensor previously saved in a directory using
export_policy_as_behavior()
.- Parameters:
path (PathLike) – The directory path
- Returns:
A policy behavior and a sensor, set to None if the could not be loaded.
- Return type:
tuple[PolicyBehavior | None, StateEstimation | None]