ray.rllib.core.learner.learner.Learner.restore_from_path#
- Learner.restore_from_path(path: str | Path, *, component: str | None = None, **kwargs) None #
Restores the state of the implementing class from the given path.
If the
component
arg is provided,path
refers to a checkpoint of a subcomponent ofself
, thus allowing the user to load only the subcomponent’s state intoself
without affecting any of the other state information (for example, loading only the NN state into a Checkpointable, which contains such an NN, but also has other state information that should NOT be changed by calling this method).The given
path
should have the following structure and contain the following files:path/ [component1]/ [component1 subcomponentA]/ ... [component1 subcomponentB]/ ... [component2]/ ... [cls.METADATA_FILE_NAME] (json) [cls.STATE_FILE_NAME] (pkl)
Note that the self.METADATA_FILE_NAME file is not required to restore the state.
- Parameters:
path – The path to load the implementing class’ state from or to load the state of only one subcomponent’s state of the implementing class (if
component
is provided).component – If provided,
path
is interpreted as the checkpoint path of only the subcomponent and thus, only that subcomponent’s state is restored/loaded. All other state ofself
remains unchanged in this case.**kwargs – Forward compatibility kwargs.