class_docstr: Unit and integration tests to check that the behavior of DINO is correct
  under FSDP.
class_docstr_tok: ["Unit","and","integration","tests","to","check","that","the","behavior","of","DINO","is","correct","under","FSDP","."]
code: def test_prehemption_during_training(self) -> None:
      with in_temporary_directory() as temp_dir:
          config = self._create_dino_pretraining_config(
              with_fsdp=True,
              with_mixed_precision=True,
              with_multicrop=True,
              gpu_count=2,
              num_epochs=2,
          )
          result = run_integration_test(config)
          losses_before = result.get_losses()
  
          temp_dir_content = os.listdir(temp_dir)
          self.assertIn(
              "model_final_checkpoint_phase1.torch", temp_dir_content
          )
          os.remove("model_final_checkpoint_phase1.torch")
          os.remove("model_final_checkpoint_phase1_shard0.torch")
          os.remove("model_final_checkpoint_phase1_shard1.torch")
          os.remove("checkpoint.torch")
          os.remove("log.txt")
  
          result = run_integration_test(config)
          losses_after = result.get_losses()
          print(losses_before)
          print(losses_after)
          self.assertAlmostEqual(
              losses_after[-1], losses_before[-1], places=5
          )
  
imports: import os
  import unittest
  import torch
  import torch.multiprocessing
  import torch.optim
  from torch.nn.parallel import DistributedDataParallel
  from vissl.models import build_model
  from vissl.models.heads.dino_head import DINOHead, DINOHeadFSDP
  from vissl.utils.checkpoint import CheckpointFormatConverter, DINOCheckpointUtils
  from vissl.utils.fsdp_utils import fsdp_wrapper
  from vissl.utils.hydra_config import compose_hydra_configuration, convert_to_attrdict
  from vissl.utils.misc import set_torch_seed
  from vissl.utils.test_utils import gpu_test, in_temporary_directory, init_distributed_on_file, run_integration_test, with_temp_files
label_desc: Use image node_id 12 for calling the TestDINO obj's underlying member method code with example usage: obj.test_prehemption_during_training() without return types