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


Python deepq.load方法代碼示例

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


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

示例1: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import load [as 別名]
def main():
    
    env = KukaGymEnv(renders=True, isDiscrete=True)
    act = deepq.load("kuka_model.pkl")
    print(act)
    while True:
        obs, done = env.reset(), False
        print("===================================")        
        print("obs")
        print(obs)
        episode_rew = 0
        while not done:
            env.render()
            obs, rew, done, _ = env.step(act(obs[None])[0])
            episode_rew += rew
        print("Episode reward", episode_rew) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:18,代碼來源:enjoy_kuka_grasping.py

示例2: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import load [as 別名]
def main():
    
    env = RacecarZEDGymEnv(renders=True)
    act = deepq.load("racecar_zed_model.pkl")
    print(act)
    while True:
        obs, done = env.reset(), False
        print("===================================")        
        print("obs")
        print(obs)
        episode_rew = 0
        while not done:
            env.render()
            obs, rew, done, _ = env.step(act(obs[None])[0])
            episode_rew += rew
        print("Episode reward", episode_rew) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:18,代碼來源:enjoy_pybullet_zed_racecar.py

示例3: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import load [as 別名]
def main():
    
    env = RacecarGymEnv(renders=True,isDiscrete=True)
    act = deepq.load("racecar_model.pkl")
    print(act)
    while True:
        obs, done = env.reset(), False
        print("===================================")        
        print("obs")
        print(obs)
        episode_rew = 0
        while not done:
            env.render()
            obs, rew, done, _ = env.step(act(obs[None])[0])
            episode_rew += rew
        print("Episode reward", episode_rew) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:18,代碼來源:enjoy_pybullet_racecar.py

示例4: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import load [as 別名]
def main():
    env = gym.make('CartPoleBulletEnv-v0')
    act = deepq.load("cartpole_model.pkl")

    while True:
        obs, done = env.reset(), False
        print("obs")
        print(obs)
        print("type(obs)")
        print(type(obs))
        episode_rew = 0
        while not done:
            env.render()
           
            o = obs[None]
            aa = act(o)
            a = aa[0]
            obs, rew, done, _ = env.step(a)
            episode_rew += rew
        print("Episode reward", episode_rew) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:22,代碼來源:enjoy_pybullet_cartpole.py

示例5: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import load [as 別名]
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--env', help='environment ID', default='SuperMarioBros-Nes')
    parser.add_argument('--gamestate', help='game state to load', default='Level1-1')
    parser.add_argument('--model', help='model pickle file from ActWrapper.save', default='model.pkl')
    args = parser.parse_args()

    env = retro_wrappers.make_retro(game=args.env, state=args.gamestate, max_episode_steps=None)
    env = retro_wrappers.wrap_deepmind_retro(env)
    act = deepq.load(args.model)

    while True:
        obs, done = env.reset(), False
        episode_rew = 0
        while not done:
            env.render()
            action = act(obs[None])[0]
            env_action = np.zeros(env.action_space.n)
            env_action[action] = 1
            obs, rew, done, _ = env.step(env_action)
            episode_rew += rew
        print('Episode reward', episode_rew) 
開發者ID:MaxSobolMark,項目名稱:HardRLWithYoutube,代碼行數:24,代碼來源:enjoy_retro.py

示例6: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import load [as 別名]
def main():
    env = gym.make("CartPole-v0")
    act = deepq.load("cartpole_model.pkl")

    while True:
        obs, done = env.reset(), False
        episode_rew = 0
        while not done:
            env.render()
            obs, rew, done, _ = env.step(act(obs[None])[0])
            episode_rew += rew
        print("Episode reward", episode_rew) 
開發者ID:Hwhitetooth,項目名稱:lirpg,代碼行數:14,代碼來源:enjoy_cartpole.py

示例7: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import load [as 別名]
def main():
    env = gym.make("MountainCar-v0")
    act = deepq.load("mountaincar_model.pkl")

    while True:
        obs, done = env.reset(), False
        episode_rew = 0
        while not done:
            env.render()
            obs, rew, done, _ = env.step(act(obs[None])[0])
            episode_rew += rew
        print("Episode reward", episode_rew) 
開發者ID:Hwhitetooth,項目名稱:lirpg,代碼行數:14,代碼來源:enjoy_mountaincar.py

示例8: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import load [as 別名]
def main():
    env = gym.make("PongNoFrameskip-v4")
    env = deepq.wrap_atari_dqn(env)
    act = deepq.load("pong_model.pkl")

    while True:
        obs, done = env.reset(), False
        episode_rew = 0
        while not done:
            env.render()
            obs, rew, done, _ = env.step(act(obs[None])[0])
            episode_rew += rew
        print("Episode reward", episode_rew) 
開發者ID:Hwhitetooth,項目名稱:lirpg,代碼行數:15,代碼來源:enjoy_pong.py

示例9: main

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import load [as 別名]
def main():
    env = gym.make("PongNoFrameskip-v4")
    env = ScaledFloatFrame(wrap_dqn(env))
    act = deepq.load("pong_model.pkl")

    while True:
        obs, done = env.reset(), False
        episode_rew = 0
        while not done:
            env.render()
            obs, rew, done, _ = env.step(act(obs[None])[0])
            episode_rew += rew
        print("Episode reward", episode_rew) 
開發者ID:AdamStelmaszczyk,項目名稱:learning2run,代碼行數:15,代碼來源:enjoy_pong.py

示例10: load_weights

# 需要導入模塊: from baselines import deepq [as 別名]
# 或者: from baselines.deepq import load [as 別名]
def load_weights(self, load_file):
		self.agent = deepq.load(load_file) 
開發者ID:benelot,項目名稱:bullet-gym,代碼行數:4,代碼來源:BaselinesDQNAgent.py


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