當前位置: 首頁>>代碼示例>>Python>>正文


Python deepq.build_act方法代碼示例

本文整理匯總了Python中baselines.deepq.build_act方法的典型用法代碼示例。如果您正苦於以下問題:Python deepq.build_act方法的具體用法?Python deepq.build_act怎麽用?Python deepq.build_act使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在baselines.deepq的用法示例。


在下文中一共展示了deepq.build_act方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: load

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import build_act [as 別名]
def load(path):
        with open(path, "rb") as f:
            model_data, act_params = cloudpickle.load(f)
        act = deepq.build_act(**act_params)
        tf_config = tf.ConfigProto()
        tf_config.gpu_options.allow_growth = True
        sess = tf.Session(config=tf_config)
        sess.__enter__()
        with tempfile.TemporaryDirectory() as td:
            arc_path = os.path.join(td, "packed.zip")
            with open(arc_path, "wb") as f:
                f.write(model_data)

            zipfile.ZipFile(arc_path, 'r', zipfile.ZIP_DEFLATED).extractall(td)
            load_state(os.path.join(td, "model"))

        return ActWrapper(act, act_params) 
開發者ID:ArztSamuel,項目名稱:DRL_DeliveryDuel,代碼行數:19,代碼來源:simple.py

示例2: load

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import build_act [as 別名]
def load(path):
        with open(path, "rb") as f:
            model_data, act_params = cloudpickle.load(f)
        act = deepq.build_act(**act_params)
        sess = tf.Session()
        sess.__enter__()
        with tempfile.TemporaryDirectory() as td:
            arc_path = os.path.join(td, "packed.zip")
            with open(arc_path, "wb") as f:
                f.write(model_data)

            zipfile.ZipFile(arc_path, 'r', zipfile.ZIP_DEFLATED).extractall(td)
            load_state(os.path.join(td, "model"))

        return ActWrapper(act, act_params) 
開發者ID:Hwhitetooth,項目名稱:lirpg,代碼行數:17,代碼來源:simple.py

示例3: load_act

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import build_act [as 別名]
def load_act(path):
        with open(path, "rb") as f:
            model_data, act_params = cloudpickle.load(f)
        act = deepq.build_act(**act_params)
        sess = tf.Session()
        sess.__enter__()
        with tempfile.TemporaryDirectory() as td:
            arc_path = os.path.join(td, "packed.zip")
            with open(arc_path, "wb") as f:
                f.write(model_data)

            zipfile.ZipFile(arc_path, 'r', zipfile.ZIP_DEFLATED).extractall(td)
            load_state(os.path.join(td, "model"))

        return ActWrapper(act, act_params) 
開發者ID:MaxSobolMark,項目名稱:HardRLWithYoutube,代碼行數:17,代碼來源:deepq.py

示例4: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import build_act [as 別名]
def main():
    set_global_seeds(1)
    args = parse_args()
    with U.make_session(4) as sess:  # noqa
        _, env = make_env(args.env)
        act = deepq.build_act(
            make_obs_ph=lambda name: U.Uint8Input(env.observation_space.shape, name=name),
            q_func=dueling_model if args.dueling else model,
            num_actions=env.action_space.n)

        U.load_state(os.path.join(args.model_dir, "saved"))
        wang2015_eval(args.env, act, stochastic=args.stochastic) 
開發者ID:AdamStelmaszczyk,項目名稱:learning2run,代碼行數:14,代碼來源:wang2015_eval.py

示例5: load

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import build_act [as 別名]
def load(path, num_cpu=16):
        with open(path, "rb") as f:
            model_data, act_params = dill.load(f)
        act = deepq.build_act(**act_params)
        sess = U.make_session(num_cpu=num_cpu)
        sess.__enter__()
        with tempfile.TemporaryDirectory() as td:
            arc_path = os.path.join(td, "packed.zip")
            with open(arc_path, "wb") as f:
                f.write(model_data)

            zipfile.ZipFile(arc_path, 'r', zipfile.ZIP_DEFLATED).extractall(td)
            U.load_state(os.path.join(td, "model"))

        return ActWrapper(act, act_params) 
開發者ID:AdamStelmaszczyk,項目名稱:learning2run,代碼行數:17,代碼來源:simple.py

示例6: load_act

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import build_act [as 別名]
def load_act(path):
        with open(path, "rb") as f:
            model_data, act_params = cloudpickle.load(f)
        act = deepq.build_act(**act_params)
        sess = tf.Session()
        sess.__enter__()
        with tempfile.TemporaryDirectory() as td:
            arc_path = os.path.join(td, "packed.zip")
            with open(arc_path, "wb") as f:
                f.write(model_data)

            zipfile.ZipFile(arc_path, 'r', zipfile.ZIP_DEFLATED).extractall(td)
            load_variables(os.path.join(td, "model"))

        return ActWrapper(act, act_params) 
開發者ID:hiwonjoon,項目名稱:ICML2019-TREX,代碼行數:17,代碼來源:deepq.py

示例7: load

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import build_act [as 別名]
def load(path, act_params, num_cpu=16):
    with open(path, "rb") as f:
      model_data = dill.load(f)
    act = deepq.build_act(**act_params)
    sess = U.make_session(num_cpu=num_cpu)
    sess.__enter__()
    with tempfile.TemporaryDirectory() as td:
      arc_path = os.path.join(td, "packed.zip")
      with open(arc_path, "wb") as f:
        f.write(model_data)

      zipfile.ZipFile(arc_path, 'r', zipfile.ZIP_DEFLATED).extractall(td)
      U.load_state(os.path.join(td, "model"))

    return ActWrapper(act) 
開發者ID:llSourcell,項目名稱:A-Guide-to-DeepMinds-StarCraft-AI-Environment,代碼行數:17,代碼來源:dqfd.py

示例8: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import build_act [as 別名]
def main():
    set_global_seeds(1)
    args = parse_args()
    with U.make_session(4):  # noqa
        _, env = make_env(args.env)
        act = deepq.build_act(
            make_obs_ph=lambda name: U.Uint8Input(env.observation_space.shape, name=name),
            q_func=dueling_model if args.dueling else model,
            num_actions=env.action_space.n)

        U.load_state(os.path.join(args.model_dir, "saved"))
        wang2015_eval(args.env, act, stochastic=args.stochastic) 
開發者ID:cxxgtxy,項目名稱:deeprl-baselines,代碼行數:14,代碼來源:wang2015_eval.py

示例9: load

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import build_act [as 別名]
def load(path):
        with open(path, "rb") as f:
            model_data, act_params = cloudpickle.load(f)
        act = deepq.build_act(**act_params)
        sess = tf.Session()
        sess.__enter__()
        with tempfile.TemporaryDirectory() as td:
            arc_path = os.path.join(td, "packed.zip")
            with open(arc_path, "wb") as f:
                f.write(model_data)

            zipfile.ZipFile(arc_path, 'r', zipfile.ZIP_DEFLATED).extractall(td)
            U.load_state(os.path.join(td, "model"))

        return ActWrapper(act, act_params) 
開發者ID:cxxgtxy,項目名稱:deeprl-baselines,代碼行數:17,代碼來源:simple.py


注:本文中的baselines.deepq.build_act方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。