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_fsdp_teacher_checkpoint(self) -> None:
      with in_temporary_directory() as pretrain_dir:
          config = self._create_dino_pretraining_config(
              with_fsdp=True,
              with_mixed_precision=True,
              with_multicrop=True,
              gpu_count=2,
              num_epochs=1,
          )
          result = run_integration_test(config)
          print(result.get_losses())
  
          # Extract the teacher from the checkpoint
          DINOCheckpointUtils.extract_teacher_from_sharded_checkpoint(
              "model_final_checkpoint_phase0.torch",
              "model_final_checkpoint_phase0_teacher.torch",
          )
          folder_content = os.listdir(pretrain_dir)
          print(folder_content)
          self.assertIn(
              "model_final_checkpoint_phase0_teacher.torch",
              folder_content,
          )
          self.assertIn(
              "model_final_checkpoint_phase0_teacher_shard0.torch",
              folder_content,
          )
          self.assertIn(
              "model_final_checkpoint_phase0_teacher_shard1.torch",
              folder_content,
          )
  
          # Consolidate the checkpoint
          CheckpointFormatConverter.sharded_to_consolidated_checkpoint(
              "model_final_checkpoint_phase0_teacher.torch",
              "model_final_checkpoint_phase0_teacher_conso.torch",
          )
          folder_content = os.listdir(pretrain_dir)
          print(folder_content)
          self.assertIn(
              "model_final_checkpoint_phase0_teacher_conso.torch",
              folder_content,
          )
  
          # Evaluate the checkpoint once consolidated
          eval_config = self._create_dino_linear_eval_config(
              checkpoint_path=os.path.join(
                  pretrain_dir,
                  "model_final_checkpoint_phase0_teacher_conso.torch",
              ),
              gpu_count=2,
              with_fsdp=True,
          )
          eval_losses = self.run_config(eval_config)
          print(eval_losses)
  
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 11 for calling the TestDINO obj's underlying member method code with example usage: obj.test_fsdp_teacher_checkpoint() without return types