快捷方式

LogValidationReward

class torchrl.trainers.LogValidationReward(*, record_interval: int, record_frames: int, frame_skip: int = 1, policy_exploration: TensorDictModule, environment: EnvBase = None, exploration_type: ExplorationType = InteractionType.RANDOM, log_keys: list[str | tuple[str]] | None = None, out_keys: dict[str | tuple[str], str] | None = None, suffix: str | None = None, log_pbar: bool = False, recorder: EnvBase = None)[原始碼]

Recorder hook for Trainer

引數:
  • record_interval (int) – testing 時兩次呼叫 recorder 的總最佳化步數。

  • record_frames (int) – testing 時要記錄的幀數。

  • frame_skip (int) – 環境中使用的 frame_skip。讓 trainer 知道每次迭代跳過的幀數很重要,否則幀數可能會被低估。最後,為了比較具有不同 frame_skip 的不同執行,必須對幀數和獎勵進行歸一化。預設為 1

  • policy_exploration (ProbabilisticTDModule) –

    用於

    1. 更新探索噪聲計劃;

    2. 在 recorder 上測試策略的策略例項。

    鑑於此例項應同時用於探索和渲染策略的效能,應透過呼叫 set_exploration_type(ExplorationType.DETERMINISTIC) 上下文管理器來關閉探索行為。

  • environment (EnvBase) – 用於 testing 的環境例項。

  • exploration_type (ExplorationType, optional) – 用於策略的探索模式。預設情況下,不使用探索,並且使用的值為 ExplorationType.DETERMINISTIC。設定為 ExplorationType.RANDOM 以啟用探索

  • log_keys (sequence of str or tuples or str, optional) – 要在 tensordict 中讀取以進行記錄的鍵。預設為 [("next", "reward")]

  • out_keys (Dict[str, str], optional) – 一個將 log_keys 對映到其在日誌中的名稱的字典。預設為 {("next", "reward"): "r_evaluation"}

  • suffix (str, optional) – 要錄製的影片的字尾。

  • log_pbar (bool, optional) – 如果為 True,則獎勵值將在進度條上記錄。預設為 False

register(trainer: Trainer, name: str = 'recorder')[原始碼]

Registers the hook in the trainer at a default location.

引數:
  • trainer (Trainer) – the trainer where the hook must be registered.

  • name (str) – the name of the hook.

注意

To register the hook at another location than the default, use register_op().

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

為初學者和高階開發者提供深入的教程

檢視教程

資源

查詢開發資源並讓您的問題得到解答

檢視資源