garage.experiment.experiment module

class AttrDict(*args, **kwargs)[source]

Bases: dict

class VariantDict(d, hidden_keys)[source]

Bases: garage.experiment.experiment.AttrDict

dump()[source]
class VariantGenerator[source]

Bases: object

Usage:

vg = VariantGenerator()
vg.add(“param1”, [1, 2, 3])
vg.add(“param2”, [‘x’, ‘y’])
vg.variants() => # all combinations of [1,2,3] x [‘x’,’y’]

Supports noncyclic dependency among parameters: | vg = VariantGenerator() | vg.add(“param1”, [1, 2, 3]) | vg.add(“param2”, lambda param1: [param1+1, param1+2]) | vg.variants() => # ..

add(key, vals, **kwargs)[source]
ivariants()[source]
to_name_suffix(variant)[source]
variant_dict(variant)[source]
variants(randomized=False)[source]
run_experiment(method_call=None, batch_tasks=None, exp_prefix='experiment', exp_name=None, log_dir=None, script='garage.experiment.experiment_wrapper', python_command='python', dry=False, env=None, variant=None, force_cpu=False, pre_commands=None, **kwargs)[source]

Serialize the method call and run the experiment using the specified mode.

Parameters:
  • method_call (callable) – A method call.
  • batch_tasks (list[dict]) – A batch of method calls.
  • exp_prefix (str) – Name prefix for the experiment.
  • exp_name (str) – Name of the experiment.
  • log_dir (str) – Log directory for the experiment.
  • script (str) – The name of the entrance point python script.
  • python_command (str) – Python command to run the experiment.
  • dry (bool) – Whether to do a dry-run, which only prints the commands without executing them.
  • env (dict) – Extra environment variables.
  • variant (dict) – If provided, should be a dictionary of parameters.
  • force_cpu (bool) – Whether to set all GPU devices invisible to force use CPU.
  • pre_commands (str) – Pre commands to run the experiment.
to_local_command(params, python_command='python', script='garage.experiment.experiment_wrapper')[source]
variant(*args, **kwargs)[source]