def main(): config = get_configuration(print_diagnostics=True, with_neptune=True, nesting_prefixes=("net_", "env_")) # You can set locally e.g. POLO_SUPERVISED_OUTPUT=/tmp/supervised_output/ output_dir = os.environ.get("POLO_SUPERVISED_OUTPUT", os.getcwd()) print("Output directory: {}".format(output_dir)) experiment = SupervisedExperiment(output_dir=output_dir, **config) experiment.run_experiment()
def main(): """Follows example from mrunner experiment_gin.py Requires BASE_PATH and GAME to be passed in config :return: """ params = get_configuration(print_diagnostics=True, with_neptune=True, inject_parameters_to_gin=True) LOG_PATH = os.path.join(params.BASE_PATH, 'tests', params.GAME) runner = RolloutsRunner(LOG_PATH,create_rainbow_rollouts_agent) runner.run_experiment()
def main(): with_neptune = True if len(os.environ.get('NEPTUNE_API_TOKEN')) == 0: print('empty token, run without neptune', file=sys.stderr) with_neptune = False params = get_configuration(print_diagnostics=True, with_neptune=with_neptune) np.random.seed(None) learn_BitFlipper_HER(10)
def main(argv): if len(argv) > 1: raise app.UsageError('Too many command-line arguments.') if FLAGS.run_mode == 'actor': if not FLAGS.is_local: get_configuration(config_file=FLAGS.mrunner_config, inject_parameters_to_FLAGS=True) actor.actor_loop(env.create_environment) elif FLAGS.run_mode == 'learner': if not FLAGS.is_local: get_configuration(config_file=FLAGS.mrunner_config, print_diagnostics=True, with_neptune=True, inject_parameters_to_FLAGS=True) experiment = neptune.get_experiment() experiment.append_tag(tag=FLAGS.nonce) neptune_tensorboard.integrate_with_tensorflow() learner.learner_loop(env.create_environment, create_agent, create_optimizer) elif FLAGS.run_mode == 'visualize': visualize.visualize(env.create_environment, create_agent, create_optimizer) else: raise ValueError('Unsupported run mode {}'.format(FLAGS.run_mode))
def main(): try: params = get_configuration(print_diagnostics=True, with_neptune=True) except TypeError: print(' ************************************************\n', ' NEPTUNE DISABLED \n', '************************************************') sleep(2) # env = gym.make("CartPole-v1") # env = gym.make("MountainCar-v0") # env = make_env_BitFlipper(n=5, space_seed=None) # env = make_env_GoalBitFlipper(n=5, space_seed=None) env = make_env_GoalRubik(step_limit=100, shuffles=100) model = HER(env) # model.learn(100000 * 16 * 50) model.learn(120000000)
def main(): params = get_configuration(print_diagnostics=True, with_neptune=True, inject_parameters_to_gin=True) LOG_PATH = os.path.join(params.BASE_PATH, 'tests', params.GAME) runner = RainbowBasicRunner(LOG_PATH, create_agent) runner.run_experiment()
import gym from mrunner.helpers.client_helper import get_configuration from spinup.sac import sac def get_get_env(env_name): def get_env(): return gym.make(env_name) return get_env def main(task, seed, steps, replay_size, batch_size, hidden_sizes): sac(get_get_env(task), seed=seed, steps=steps, replay_size=replay_size, batch_size=batch_size, actor_kwargs=dict(hidden_sizes=hidden_sizes), critic_kwargs=dict(hidden_sizes=hidden_sizes)) if __name__ == '__main__': config = get_configuration(print_diagnostics=True, with_neptune=True) experiment_id = config.pop('experiment_id') main(**config)
import gym import neptune from stable_baselines import DQN from stable_baselines.logger import KVWriter from stable_baselines.logger import Logger from mrunner.helpers.client_helper import get_configuration class NeptuneFormat(KVWriter): def writekvs(self, kvs): for key, value in sorted(kvs.items()): neptune.send_metric(key, value) if __name__ == "__main__": params = get_configuration(with_neptune=True, inject_parameters_to_gin=True) Logger.CURRENT = Logger(folder=None, output_formats=[NeptuneFormat()]) # Create environment env = gym.make('LunarLander-v2') # Instantiate the agent model = DQN('MlpPolicy', env, learning_rate=params["learning_rate"], prioritized_replay=params["prioritized_replay"], verbose=params["verbose"]) # Train the agent model.learn(total_timesteps=params["total_timesteps"], log_interval=params["log_interval"])