imitation.util.registry#
Registry mapping IDs to objects, such as environments or policy loaders.
Module Attributes
The type stored in Registry is commonly an instance of LoaderFn. |
Functions
|
Converts a factory taking an environment into a LoaderFn. |
|
Converts a factory taking observation and action space into a LoaderFn. |
|
Load an attribute in format path.to.module:attribute. |
Classes
|
A registry mapping IDs to type T objects, with support for lazy loading. |
- imitation.util.registry.LoaderFn#
The type stored in Registry is commonly an instance of LoaderFn.
alias of
Callable
[[…],T
]
- class imitation.util.registry.Registry[source]#
Bases:
Generic
[T
]A registry mapping IDs to type T objects, with support for lazy loading.
The registry allows for insertion and retrieval. Modification of existing elements is not allowed.
If the registered item is a string, it is assumed to be a path to an attribute in the form path.to.module:attribute. In this case, the module is loaded only if and when the registered item is retrieved.
This is helpful both to reduce overhead from importing unused modules, and when some modules may have additional dependencies that are not installed in all deployments.
Note: This is a similar idea to gym.EnvRegistry.
- imitation.util.registry.build_loader_fn_require_env(fn, **kwargs)[source]#
Converts a factory taking an environment into a LoaderFn.
- Return type
Callable
[...
,TypeVar
(T
)]