garage.experiment.snapshotter module

Defines SnapshotConfig and Snapshotter.

class SnapshotConfig(snapshot_dir, snapshot_mode, snapshot_gap)

Bases: tuple

snapshot_dir

Alias for field number 0

snapshot_gap

Alias for field number 2

snapshot_mode

Alias for field number 1

class Snapshotter(snapshot_dir='/home/docs/checkouts/readthedocs.org/user_builds/garage/checkouts/v2019.10.1/docs/data/local/experiment', snapshot_mode='last', snapshot_gap=1)[source]

Bases: object

Snapshotter snapshots training data.

When training, it saves data to binary files. When resuming, it loads from saved data.

Parameters:
  • snapshot_dir (str) – Path to save the log and iteration snapshot.
  • snapshot_mode (str) – Mode to save the snapshot. Can be either “all” (all iterations will be saved), “last” (only the last iteration will be saved), “gap” (every snapshot_gap iterations are saved), or “none” (do not save snapshots).
  • snapshot_gap (int) – Gap between snapshot iterations. Wait this number of iterations before taking another snapshot.
load(load_dir, itr='last')[source]

Load one snapshot of parameters from disk.

Parameters:
  • load_dir (str) – Directory of the pickle file to resume experiment from.
  • itr (int or string) – Iteration to load. Can be an integer, ‘last’ or ‘first’.
Returns:

Loaded snapshot

Return type:

dict

save_itr_params(itr, params)[source]

Save the parameters if at the right iteration.

snapshot_dir

Return the directory of snapshot.

snapshot_gap

Return the wait number of snapshot.

snapshot_mode

Return the type of snapshot.