all.experiments

class all.experiments.Experiment(logger, quiet)

Bases: ABC

An Experiment manages the basic train/test loop and logs results.

Parameters:
  • ( (logger) – torch.logging.logger:): A Logger object used for logging.

  • quiet (bool) – If False, the Experiment will print information about episode returns to standard out.

close()
abstract property episode

The index of the current training episode

abstract property frame

The index of the current training frame.

save()
abstract test(episodes=100)

Test the agent in eval mode for a certain number of episodes.

Parameters:

episodes (int) – The number of test episodes.

Returns:

A list of all returns received during testing.

Return type:

list(float)

abstract train(frames=inf, episodes=inf)

Train the agent for a certain number of frames or episodes. If both frames and episodes are specified, then the training loop will exit when either condition is satisfied.

Parameters:
  • frames (int) – The maximum number of training frames.

  • episodes (bool) – The maximum number of training episodes.

class all.experiments.MultiagentEnvExperiment(preset, env, logdir='runs', name=None, quiet=False, render=False, save_freq=100, train_steps=inf, verbose=True)

Bases: object

An Experiment object for training and testing Multiagents.

Parameters:
  • preset (all.presets.Preset) – A Multiagent preset.

  • env (all.environments.MultiagentEnvironment) – A multiagent environment.

  • log_dir (str, optional) – The directory in which to save the logs and model.

  • name (str, optional) – The name of the experiment.

  • quiet (bool, optional) – Whether or not to print training information.

  • render (bool, optional) – Whether or not to render during training.

  • save_freq (int, optional) – How often to save the model to disk.

  • train_steps (int, optional) – The number of steps for which to train.

  • verbose (bool, optional) – Whether or not to log detailed information or only summaries.

close()
property episode
property frame
save()
test(episodes=100)
train(frames=inf, episodes=inf)
class all.experiments.ParallelEnvExperiment(preset, env, name=None, train_steps=inf, logdir='runs', quiet=False, render=False, save_freq=100, verbose=True)

Bases: Experiment

An Experiment object for training and testing agents that use parallel training environments.

property episode

The index of the current training episode

property frame

The index of the current training frame.

test(episodes=100)

Test the agent in eval mode for a certain number of episodes.

Parameters:

episodes (int) – The number of test episodes.

Returns:

A list of all returns received during testing.

Return type:

list(float)

train(frames=inf, episodes=inf)

Train the agent for a certain number of frames or episodes. If both frames and episodes are specified, then the training loop will exit when either condition is satisfied.

Parameters:
  • frames (int) – The maximum number of training frames.

  • episodes (bool) – The maximum number of training episodes.

class all.experiments.SingleEnvExperiment(preset, env, name=None, train_steps=inf, logdir='runs', quiet=False, render=False, save_freq=100, verbose=True)

Bases: Experiment

An Experiment object for training and testing agents that interact with one environment at a time.

property episode

The index of the current training episode

property frame

The index of the current training frame.

test(episodes=100)

Test the agent in eval mode for a certain number of episodes.

Parameters:

episodes (int) – The number of test episodes.

Returns:

A list of all returns received during testing.

Return type:

list(float)

train(frames=inf, episodes=inf)

Train the agent for a certain number of frames or episodes. If both frames and episodes are specified, then the training loop will exit when either condition is satisfied.

Parameters:
  • frames (int) – The maximum number of training frames.

  • episodes (bool) – The maximum number of training episodes.

class all.experiments.SlurmExperiment(agents, envs, frames, test_episodes=100, verbose=False, job_name='autonomous-learning-library', script_name='experiment.sh', outdir='out', logdir='runs', sbatch_args=None)

Bases: object

create_sbatch_script()
make_output_directory()
parse_args()
queue_jobs()
run_experiment()
run_sbatch_script()
all.experiments.load_and_watch(filename, env, fps=60, n_episodes=9223372036854775807)
all.experiments.plot_returns_100(runs_dir, timesteps=-1)
all.experiments.run_experiment(agents, envs, frames, logdir='runs', quiet=False, render=False, save_freq=100, test_episodes=100, verbose=True)
all.experiments.watch(agent, env, fps=60, n_episodes=9223372036854775807)