rlmesh.torch.EnvFactory
Torch-backed EnvFactory: served envs speak torch.
The producer-side mirror of Model (the author’s own class). Subclass
and implement make exactly as for rlmesh.EnvFactory; the torch
framework rides this class, so every serve route (serve, the python -m rlmesh.serve CLI, a prebuilt/sandbox image) types the obs/action seam as torch
without a per-entrypoint flag. To serve a plain (already-built) env, hand it to
the neutral rlmesh.EnvServer(env, framework="torch") instead – the server
stays framework-neutral; the framework is a value you set on the env side.
Attributes
Methods
- tags_for()Return the
EnvTagsfor one discriminant binding. - prepare()Optional: one-time setup before
make(). - describe()Return this factory's full metadata envelope (see
rlmesh.describe()). - make()Construct and return the environment.
- close()Optional: release resources.
- serve()Host this env on
address(blocking):prepare()+make(**make_kwargs), publishtags.
params
attribute[source]params: ParamSpec | Nonetag_params
attribute[source]tag_params: tuple[str, ...]reset_options
attribute[source]reset_options: tuple[str, ...]workflow_edition
attribute[source]workflow_edition: str | Noneprepare
function[source]prepare() -> NoneOptional: one-time setup before make().
describe
function[source]describe() -> dict[str, Any]Return this factory’s full metadata envelope (see rlmesh.describe()).
make
function[source]make(**kwargs: Any) -> EnvLike[Any, Any]Construct and return the environment.
Your override returns a plain env; the returned env is automatically
stamped with this factory’s tags (in env.metadata), so the tag
rides the environment – a spec’d model can resolve its adapter from the
env alone, whether it is served or driven locally via
rlmesh.session().
close
function[source]close() -> NoneOptional: release resources.
serve
function[source]serve(
address: str,
*,
num_envs: int = 1,
vectorization_mode: str | None = None,
framework: str | None = None,
device: object | None = None,
workflow_edition: str | None = None,
**make_kwargs: Any,
) -> NoneHost this env on address (blocking): prepare() + make(**make_kwargs), publish tags.
The named keywords are serving options, forwarded to
rlmesh.serve.serve_env() (num_envs > 1 fans make out into a
vector env; framework/device type and place the served obs/action
seam; workflow_edition overrides this class’s
workflow_edition declaration for this endpoint); every other
keyword goes to make. Naming them here keeps a make
kwarg from silently binding to a serving option – a make parameter that
shares a serving option’s name cannot ride through serve.