all.presets

class all.presets.IndependentMultiagentPreset(name, device, presets)

Bases: all.presets.preset.Preset

agent(writer=<all.logging.DummyWriter object>, train_steps=inf)

Instantiate a training-mode Agent with the existing model.

Parameters
  • writer (all.logging.Writer, optional) – Coefficient for the entropy term in the total loss.

  • train_steps (int, optional) – The number of steps for which the agent will be trained.

Returns

The instantiated Agent.

Return type

all.agents.Agent

test_agent()

Instansiate a test-mode Agent with the existing model.

Returns

The instantiated test Agent.

Return type

all.agents.Agent

class all.presets.ParallelPreset(name, device, hyperparameters)

Bases: abc.ABC

A Preset ParallelAgent factory.

This is the ParallelAgent version of all.presets.Preset. This class allows the user to instantiate preconfigured ParallelAgents and test Agents. All Agents constructed by the ParallelPreset share a network model and parameters. However, other objects, such as ReplayBuffers, are independently created for each Agent. The ParallelPreset can be saved and loaded from disk.

abstract agent(writer=None, train_steps=inf)

Instantiate a training-mode ParallelAgent with the existing model.

Parameters
  • writer (all.logging.Writer, optional) – Coefficient for the entropy term in the total loss.

  • train_steps (int, optional) – The number of steps for which the agent will be trained.

Returns

The instantiated Agent.

Return type

all.agents.ParallelAgent

property n_envs
abstract parallel_test_agent()

Instantiate a test-mode ParallelAgent with the existing model. See also: ParallelPreset.test_agent()

Returns

The instantiated test ParallelAgent.

Return type

all.agents.ParallelAgent

save(filename)

Save the preset and the contained model to disk.

The preset can later be loaded using torch.load(filename), allowing a test mode agent to be instantiated for evaluation or other purposes.

Parameters

filename (str) – The path where the preset should be saved.

abstract test_agent()

Instantiate a test-mode Agent with the existing model. See also: ParallelPreset.parallel_test_agent()

Returns

The instantiated test Agent.

Return type

all.agents.Agent

class all.presets.ParallelPresetBuilder(default_name, default_hyperparameters, constructor, device='cuda', env=None, hyperparameters=None, name=None)

Bases: all.presets.builder.PresetBuilder

build()
class all.presets.Preset(name, device, hyperparameters)

Bases: abc.ABC

A Preset Agent factory.

This class allows the user to instantiate preconfigured Agents and test Agents. All Agents constructed by the Preset share a network model and parameters. However, other objects, such as ReplayBuffers, are independently created for each Agent. The Preset can be saved and loaded from disk.

abstract agent(writer=None, train_steps=inf)

Instantiate a training-mode Agent with the existing model.

Parameters
  • writer (all.logging.Writer, optional) – Coefficient for the entropy term in the total loss.

  • train_steps (int, optional) – The number of steps for which the agent will be trained.

Returns

The instantiated Agent.

Return type

all.agents.Agent

save(filename)

Save the preset and the contained model to disk.

The preset can later be loaded using torch.load(filename), allowing a test mode agent to be instantiated for evaluation or other purposes.

Parameters

filename (str) – The path where the preset should be saved.

abstract test_agent()

Instansiate a test-mode Agent with the existing model.

Returns

The instantiated test Agent.

Return type

all.agents.Agent

class all.presets.PresetBuilder(default_name, default_hyperparameters, constructor, device='cuda', env=None, hyperparameters=None, name=None)

Bases: object

build()
device(device)
env(env)
hyperparameters(**hyperparameters)
name(name)