rlmesh.torch.RemoteModel
Experimental Torch-backed handle to a served model (policy).
RemoteModel(
address: str | None = None,
*,
host: str | None = None,
port: int | None = None,
path: str | None = None,
transport: Transport | None = None,
connect_timeout_seconds: float | None = None,
request_timeout_seconds: float | None = None,
) -> NoneBind it to an env with rlmesh.session(model, env) to get a
rlmesh.Session whose predict accepts and returns Torch values,
driven symmetrically with the env.
Parameters
| Name | Type | Description |
|---|---|---|
address | str | None | Model endpoint address such as "tcp://127.0.0.1:5556". |
host | str | None | TCP host helper used when address is omitted. |
port | int | None | TCP port helper used when address is omitted. |
path | str | None | Unix socket path helper used when address is omitted. |
transport | Transport | None | Explicit transport selector. |
Examples
>>> import rlmesh
>>> from rlmesh.torch import RemoteEnv, RemoteModel
>>> env = RemoteEnv("127.0.0.1:5555")
>>> sess = rlmesh.session(RemoteModel("127.0.0.1:5556"), env)
>>> obs, _ = sess.reset(seed=0)
>>> action = sess.predict(obs)
>>> obs, reward, terminated, truncated, _ = sess.step(action)Attributes
Methods
address
property[source]property address: strModel endpoint address this handle dials.
session
function[source]session(
env: EnvTarget,
*,
instruction: str | None = None,
close_env: bool = False,
trust_entrypoints: bool | None = None,
execution_horizon: int = 1,
view: ViewArg = None,
workflow_edition: str | None = None,
) -> Session[Any, Any]Bind this served policy to env and return a rlmesh.Session.
env is an env client (e.g. RemoteEnv/SandboxEnv) exposing an
env_contract; that contract – including the env’s adapter tags – is sent
to the model server, which resolves its adapter for this env. instruction
and trust_entrypoints apply to local models and are rejected here (the
served model owns its adapter). view opts into the built-in live viewer
over this client’s own env loop (see rlmesh.run()).
execution_horizon (> 1) opts a chunk-capable served model into action
chunking: the model emits its native chunk, and this client replays a prefix
of it one action per step open-loop (skipping the RPC), re-planning every
execution_horizon steps. The model must define predict_chunk;
otherwise it re-plans every step.
workflow_edition declares this runtime’s edition for the session,
ahead of the process and project declarations. It also overrides the
runtime declaration used to connect the env handle; the env server’s
own declaration still constrains the session floor.