当前位置: 首页>>代码示例>>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;未经允许,请勿转载。