Transport and inference protocols for the inference package.
ObservationTransport
Bases: Protocol
Receives raw observations from the environment.
receive
receive(requested_keys, compression_type)
Receive one observation packet from the environment.
Source code in src/versatil/inference/protocol.py
| def receive(self, requested_keys: list[str], compression_type: str) -> dict:
"""Receive one observation packet from the environment."""
...
|
register
Register a client with the environment server.
Source code in src/versatil/inference/protocol.py
| def register(self, client_name: str) -> dict:
"""Register a client with the environment server."""
...
|
close
Close transport resources.
Source code in src/versatil/inference/protocol.py
| def close(self) -> None:
"""Close transport resources."""
...
|
ActionTransport
Bases: Protocol
Sends actions to the environment.
send
send(actions, action_metadata)
Send one action packet to the environment.
Source code in src/versatil/inference/protocol.py
| def send(self, actions: dict, action_metadata: dict) -> dict:
"""Send one action packet to the environment."""
...
|
close
Release transport resources.
Source code in src/versatil/inference/protocol.py
| def close(self) -> None:
"""Release transport resources."""
...
|
OnlineExplanationSource
Bases: Protocol
Converts model-ready online inference windows into explanations.
explain_observation_batch
explain_observation_batch(observation, display_observation, environment_indices, timestep)
Explain one ready inference batch.
Source code in src/versatil/inference/protocol.py
| def explain_observation_batch(
self,
observation: dict[str, InferenceObservationValue],
display_observation: dict[str, torch.Tensor],
environment_indices: list[int],
timestep: int,
) -> None:
"""Explain one ready inference batch."""
...
|