class_docstr: Check that loading a checkpoint during training works
  Check that loading a checkpoint for benchmarking works
class_docstr_tok: ["Check","that","loading","a","checkpoint","during","training","works","Check","that","loading","a","checkpoint","for","benchmarking","works"]
code: def run_preemption_test(
      self, config: AttrDict, compare_losses: bool = True
  ):
      initial_result = run_integration_test(config)
      (
          initial_iters,
          initial_losses,
      ) = initial_result.get_losses_with_iterations()
  
      initial_result.clean_final_checkpoint()
      initial_result.clean_logs()
  
      restart_result = run_integration_test(config)
      (
          restart_iters,
          restart_losses,
      ) = restart_result.get_losses_with_iterations()
  
      print("INITIAL:", initial_iters, initial_losses)
      print("RESTART:", restart_iters, restart_losses)
      self.assertEqual(
          initial_iters[-len(restart_iters) :], restart_iters
      )
      if compare_losses:
          self.assertEqual(
              initial_losses[-len(restart_losses) :], restart_losses
          )
  
imports: import os
  import unittest
  from vissl.config.attr_dict import AttrDict
  from vissl.utils.checkpoint import CheckpointFormatConverter
  from vissl.utils.hydra_config import compose_hydra_configuration, convert_to_attrdict
  from vissl.utils.test_utils import gpu_test, in_temporary_directory, run_integration_test
label_desc: Use image node_id 2 for calling the TestStateCheckpointing obj's underlying member method code with example usage: obj.run_preemption_test(config, compare_losses) without return types