code: def train_and_checkpoint(
      hparams: typing.Dict,
      trial_class: pytorch.PyTorchTrial,
      tmp_path: pathlib.Path,
      exp_config: typing.Dict,
      steps: typing.Tuple[int, int] = (1, 1),
      trial_args: typing.Optional[typing.Dict] = None,
  ) -> None:
      # Trial A: train batches and checkpoint
      steps_completed = train_for_checkpoint(
          hparams=hparams,
          trial_class=trial_class,
          tmp_path=tmp_path,
          exp_config=exp_config,
          steps=steps[0],
          trial_args=trial_args,
      )
  
      # Trial B: restore from checkpoint and train for more batches
      train_from_checkpoint(
          hparams=hparams,
          trial_class=trial_class,
          tmp_path=tmp_path,
          exp_config=exp_config,
          steps=steps,
          batches_trained=steps_completed,
          trial_args=trial_args,
      )
  
file_path: determined/harness/tests/experiment/pytorch_utils.py
imports: import os
  import pathlib
  import random
  import sys
  import typing
  import uuid
  from torch.distributed import launcher
  import determined
  from determined import gpu, pytorch
  from tests.experiment import utils
label_desc: Use image node_id 4 for calling a global function with example usage: train_and_checkpoint(hparams, trial_class, tmp_path, exp_config, steps, trial_args) without return types