def main(): # run on gpu device = 'cuda' def get_agents(preset): agents = [ getattr(preset, agent_name) for agent_name in classic_control.__all__ ] return [agent(device=device) for agent in agents] SlurmExperiment(get_agents(atari), AtariEnvironment('Breakout', device=device), 2e7, sbatch_args={'partition': '1080ti-long'}) SlurmExperiment(get_agents(classic_control), GymEnvironment('CartPole-v0', device=device), 100000, sbatch_args={'partition': '1080ti-short'}) SlurmExperiment(get_agents(continuous), GymEnvironment('LunarLanderContinuous-v2', device=device), 500000, sbatch_args={'partition': '1080ti-short'})
def main(): device = 'cuda' envs = [ AtariEnvironment(env, device) for env in ['Pong', 'Breakout', 'SpaceInvaders'] ] SlurmExperiment(a2c(device=device), envs, 1e6, sbatch_args={'partition': '1080ti-short'})
def main(): frames = int(1e7) agents = [ddpg, ppo, sac] envs = [ PybulletEnvironment(env, device='cuda') for env in PybulletEnvironment.short_names ] SlurmExperiment(agents, envs, frames, logdir='benchmarks/pybullet', sbatch_args={'partition': '1080ti-long'})
def main(): agents = [ atari.a2c(), atari.c51(), atari.dqn(), atari.ddqn(), atari.ppo(), atari.rainbow(), ] envs = [ AtariEnvironment(env, device='cuda') for env in ['BeamRider', 'Breakout', 'Pong', 'Qbert', 'SpaceInvaders'] ] SlurmExperiment(agents, envs, 10e6, sbatch_args={'partition': '1080ti-long'})
def main(): device = 'cuda' frames = int(1e7) agents = [ ddpg(last_frame=frames), ppo(last_frame=frames), sac(last_frame=frames) ] envs = [ GymEnvironment(env, device) for env in [ 'AntBulletEnv-v0', "HalfCheetahBulletEnv-v0", 'HumanoidBulletEnv-v0', 'HopperBulletEnv-v0', 'Walker2DBulletEnv-v0' ] ] SlurmExperiment(agents, envs, frames, sbatch_args={'partition': '1080ti-long'})
''' Run the rull atari suite on swarm with a2c. You should modify this script to suit your needs. ''' from gym import envs from all.experiments import SlurmExperiment from all.presets.atari import a2c from all.environments import GymEnvironment # Use the first available GPU device = 'cuda' # Get all atari envs. # Note that this actually returns some games that aren't compatible. # Those slurm tasks will simply fail. envs = [ GymEnvironment(env, device) for env in envs.registry.env_specs.keys() if 'NoFrameskip-v4' in env and not '-ram' in env ] SlurmExperiment( a2c, envs, 1e9, hyperparameters={'device': device}, sbatch_args={ 'partition': '1080ti-long' # long queue: run for a week })
''' Run the rull atari suite on swarm with a2c. You should modify this script to suit your needs. ''' from gym import envs from all.experiments import SlurmExperiment from all.presets.atari import a2c from all.environments import GymEnvironment # Use the first available GPU device = 'cuda' # Get all atari envs. # Note that this actually returns some games that aren't compatible. # Those slurm tasks will simply fail. envs = [ GymEnvironment(env, device) for env in envs.registry.env_specs.keys() if 'NoFrameskip-v4' in env and not '-ram' in env ] SlurmExperiment( a2c(device=device), envs, 1e9, sbatch_args={ 'partition': '1080ti-long' # long queue: run for a week })
''' Quick demo of a2c running on slurm. Note that it only runs for 1 million frames. For real experiments, you will surely need a modified version of this script. ''' from gym import envs from all.experiments import SlurmExperiment from all.presets.atari import a2c from all.environments import AtariEnvironment # Quick demo of a2c running on slurm. # Note that it only runs for 1 million frames. # For real experiments, you will surely need a modified version of this script. device = 'cuda' envs = [AtariEnvironment(env, device) for env in ['Pong', 'Breakout', 'SpaceInvaders']] SlurmExperiment(a2c, envs, 1e6, hyperparameters={'device': device}, sbatch_args={ 'partition': '1080ti-short' })
''' Quick demo of a2c running on slurm. Note that it only runs for 1 million frames. For real experiments, you will surely need a modified version of this script. ''' from gym import envs from all.experiments import SlurmExperiment from all.presets.atari import a2c from all.environments import AtariEnvironment device = 'cuda' envs = [ AtariEnvironment(env, device) for env in ['Pong', 'Breakout', 'SpaceInvaders'] ] SlurmExperiment(a2c(device=device), envs, 1e6, sbatch_args={'partition': '1080ti-short'})
'''Create slurm tasks to run benchmark suite''' import argparse from all.environments import AtariEnvironment, GymEnvironment from all.experiments import SlurmExperiment from all.presets import atari, classic_control # run on gpu device = 'cuda' # create slurm tasks for running classic control agents for agent_name in classic_control.__all__: print('CartPole-v0,', agent_name) agent = getattr(classic_control, agent_name) envs = [GymEnvironment('CartPole-v0', device=device)] SlurmExperiment(agent, envs, 100000, hyperparameters={'device': device}, sbatch_args={'partition': '1080ti-short'}) # create slurm tasks for running atari agents for agent_name in atari.__all__: print('Breakout', agent_name) agent = getattr(atari, agent_name) envs = [AtariEnvironment('Breakout', device=device)] SlurmExperiment(agent, envs, 2e7, hyperparameters={'device': device}, sbatch_args={'partition': '1080ti-long'})
import argparse from all.environments import AtariEnvironment, GymEnvironment from all.experiments import SlurmExperiment from all.presets import atari, classic_control, continuous # run on gpu device = 'cuda' def get_agents(preset): agents = [getattr(preset, agent_name) for agent_name in classic_control.__all__] return [agent(device=device) for agent in agents] SlurmExperiment( get_agents(atari), AtariEnvironment('Breakout', device=device), 2e7, sbatch_args={ 'partition': '1080ti-long' } ) SlurmExperiment( get_agents(classic_control), GymEnvironment('CartPole-v0', device=device), 100000, sbatch_args={ 'partition': '1080ti-short' } ) SlurmExperiment( get_agents(continuous),
from gym import envs from all.experiments import SlurmExperiment from env import ProcgenAtariEnv from a2c import a2c envs = [ 'bigfish', 'bossfight', 'caveflyer', 'chaser', 'climber', 'coinrun', 'dodgeball', 'fruitbot', 'heist', 'jumper', 'leaper', 'maze', 'miner', 'ninja', 'plunder', 'starpilot', ] frames = 200e6 device = 'cuda' envs = [ProcgenAtariEnv(env, device=device) for env in envs] SlurmExperiment(a2c(device=device, entropy_loss_scaling=0.01, last_frame=frames), envs, frames, sbatch_args={ 'partition': '1080ti-long' })