class_docstr: A run of a training script.
class_docstr_tok: ["A","run","of","a","training","script","."]
docstr: Create a checkpoint within this experiment.
  
  This saves the metrics at this point, and makes a copy of the file or directory passed to `path`, which could be weights or any other artifact.
docstr_tok: ["Create","a","checkpoint","within","this","experiment",".","This","saves","the","metrics","at","this","point",",","and","makes","a","copy","of","the","file","or","directory","passed","to","`","path","`",",","which","could","be","weights","or","any","other","artifact","."]
code: def checkpoint(
      self,
      path: Optional[str] = None,
      step: Optional[int] = None,
      metrics: Optional[Dict[str, Any]] = None,
      primary_metric: Optional[Tuple[str, str]] = None,
      quiet: bool = False,
  ) -> Optional[Checkpoint]:
      """
      Create a checkpoint within this experiment.
  
      This saves the metrics at this point, and makes a copy of the file or directory passed to `path`, which could be weights or any other artifact.
      """
      # protobuf 3 doesn't have optionals, so path=None becomes ""
      # and we have no way of differentiating between empty strings
      # and Nones
      if path == "":
          raise ValueError(
              "path cannot be an empty string. Please use path=None or omit path if you don't want to save any files."
          )
  
      primary_metric_dict: Optional[PrimaryMetric] = None
      if primary_metric is not None:
          if len(primary_metric) != 2:
              # Not having a primary_metric isn't a fatal problem
              console.error(
                  "Not setting primary_metric on checkpoint: it must be a tuple of (name, goal), where name corresponds to a metric key, and goal is either 'maximize' or 'minimize'"
              )
          else:
              primary_metric_dict = {
                  "name": primary_metric[0],
                  "goal": primary_metric[1],
              }
  
      # Auto-increment step if not provided
      if step is None:
          step = self._step + 1
      # Remember the current step
      self._step = step
  
      checkpoint = self._project._daemon().create_checkpoint(
          experiment=self,
          path=path,
          step=step,
          metrics=metrics,
          primary_metric=primary_metric_dict,
          quiet=quiet,
      )
      self.checkpoints.append(checkpoint)
      self._save(quiet=quiet)
      return checkpoint
  
imports: import datetime
  import getpass
  import html
  import json
  import math
  import os
  import shlex
  import sys
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, MutableSequence, Optional, Tuple
  from .None import console
  from .checkpoint import Checkpoint, CheckpointList, PrimaryMetric
  from .metadata import parse_rfc3339, rfc3339_datetime
  from .packages import get_imported_packages
  from .system import get_python_version
  from .validate import check_path
  from .version import version
label_desc: Use image node_id 4 for calling the Experiment obj's underlying member method code with example usage: obj.checkpoint(path, step, metrics, primary_metric, quiet) and returns: checkpoint