class_docstr: Snapshotter snapshots training data.
  
  When training, it saves data to binary files. When resuming,
  it loads from saved data.
  
  Args:
      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),
          "gap_and_last" (save the last iteration as 'params.pkl' and save
          every snapshot_gap iteration separately), "gap_overwrite" (same as
          gap but overwrites the last saved snapshot), or "none" (do not
          save snapshots).
      snapshot_gap (int): Gap between snapshot iterations. Wait this number
          of iterations before taking another snapshot.
class_docstr_tok: ["Snapshotter","snapshots","training","data",".","When","training",",","it","saves","data","to","binary","files",".","When","resuming",",","it","loads","from","saved","data",".","Args",":","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",")",",","``","gap_and_last","''","(","save","the","last","iteration","as","'params.pkl","'","and","save","every","snapshot_gap","iteration","separately",")",",","``","gap_overwrite","''","(","same","as","gap","but","overwrites","the","last","saved","snapshot",")",",","or","``","none","''","(","do","not","save","snapshots",")",".","snapshot_gap","(","int",")",":","Gap","between","snapshot","iterations",".","Wait","this","number","of","iterations","before","taking","another","snapshot","."]
code: def __init__(
      self,
      snapshot_dir=os.path.join(os.getcwd(), "data/local/experiment"),
      snapshot_mode="last",
      snapshot_gap=1,
  ):
      self._snapshot_dir = snapshot_dir
      self._snapshot_mode = snapshot_mode
      self._snapshot_gap = snapshot_gap
  
      if snapshot_mode == "gap_overwrite" and snapshot_gap <= 1:
          raise ValueError(
              "snapshot_gap must be > 1 when using "
              'snapshot_mode="gap_overwrite". Use '
              'snapshot_mode="last" to snapshot after '
              "every iteration."
          )
      if snapshot_mode == "last" and snapshot_gap != 1:
          raise ValueError(
              "snapshot_gap should be set to 1 if using "
              'snapshot_mode="last". Did you mean to'
              ' use snapshot_mode="gap"?'
          )
  
      pathlib.Path(snapshot_dir).mkdir(parents=True, exist_ok=True)
  
file_path: garage/src/garage/experiment/snapshotter.py
imports: import collections
  import errno
  import os
  import pathlib
  import cloudpickle
label_desc: Use image node_id 1 to create a new Snapshotter object  with example: obj = Snapshotter(snapshot_dir, snapshot_mode, snapshot_gap)