class_docstr: Test the Regnet FSDP model in comparison with the DDP Regnet
  to verify that both converge to the same losses
class_docstr_tok: ["Test","the","Regnet","FSDP","model","in","comparison","with","the","DDP","Regnet","to","verify","that","both","converge","to","the","same","losses"]
code: def test_fsdp_integration_with_linear_eval(self) -> None:
      with in_temporary_directory() as pretrain_dir:
          # Start pre-training
          config = self._create_pretraining_config(
              with_fsdp=True,
              with_activation_checkpointing=True,
              with_mixed_precision=False,
              auto_wrap_threshold=0,
          )
          run_integration_test(config)
  
          # Consolidate the weights (3 different ways)
          CheckpointFormatConverter.sharded_to_consolidated_checkpoint(
              "checkpoint.torch", "checkpoint_conso.torch"
          )
          CheckpointFormatConverter.sharded_to_sliced_checkpoint(
              "checkpoint.torch", "checkpoint_sliced.torch"
          )
          CheckpointFormatConverter.consolidated_to_sliced_checkpoint(
              "checkpoint_conso.torch", "checkpoint_sliced_2.torch"
          )
  
          # Load the sharded checkpoint and perform a inear evaluation on it
          ref_losses = self.run_linear_eval(
              checkpoint_path=os.path.join(
                  pretrain_dir, "checkpoint.torch"
              ),
              with_fsdp=True,
              with_mixed_precision=False,
              auto_wrap_threshold=0,
          )
          self.assertEqual(8, len(ref_losses))
  
          # Then check that the results are the same for the other kind of
          # checkpoints after consolidation has taken place
          for checkpoint_name in [
              "checkpoint_conso.torch",
              "checkpoint_sliced.torch",
              "checkpoint_sliced_2.torch",
          ]:
              losses = self.run_linear_eval(
                  checkpoint_path=os.path.join(
                      pretrain_dir, checkpoint_name
                  ),
                  with_fsdp=True,
                  with_mixed_precision=False,
                  auto_wrap_threshold=0,
              )
              self.assertEqual(8, len(losses))
              self.assertAlmostEqual(
                  losses[0],
                  ref_losses[0],
                  places=4,
                  msg=f"Failed for {checkpoint_name}",
              )
  
imports: import os
  import unittest
  import numpy
  import torch
  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 9 for calling the TestRegnetFSDPIntegration obj's underlying member method code with example usage: obj.test_fsdp_integration_with_linear_eval() without return types