簡體   English   中英

在 rllib 中注冊健身房環境時傳遞可選的 arguments

[英]Passing optional arguments when registering gym environment in rllib

我一直在按照這里有用的示例在健身房中創建一個自定義環境,然后我想在 rllib 中進行訓練。

我的環境有一些可選參數,我想在訓練時使用 select。 我認為代碼的相關部分在train.py中:

    # start Ray -- add `local_mode=True` here for debugging
    ray.init(ignore_reinit_error=True)

    # register the custom environment
    select_env = "example-v0"
    register_env(select_env, lambda config: Example_v0())

我嘗試了一些明顯的東西,比如

    register_env(select_env, lambda config: Example_v0(optional_arg=n))

但似乎沒有任何效果。 有沒有辦法在訓練前通過不同的arguments?

我認為你應該在構造函數中使用 env_config 然后傳遞字典 env_config = {'optional_arg': n}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM