ray.rllib.evaluation.rollout_worker.RolloutWorker.get_weights#
- RolloutWorker.get_weights(policies: Collection[str] | None = None, inference_only: bool = False) Dict[str, dict] [source]#
Returns each policies’ model weights of this worker.
- Parameters:
policies – List of PolicyIDs to get the weights from. Use None for all policies.
inference_only – This argument is only added for interface consistency with the new api stack.
- Returns:
Dict mapping PolicyIDs to ModelWeights.
from ray.rllib.evaluation.rollout_worker import RolloutWorker # Create a RolloutWorker. worker = ... weights = worker.get_weights() print(weights)
{"default_policy": {"layer1": array(...), "layer2": ...}}