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"]
docstr: Run SWAV architecture with DDP or with FSDP with or without
  activation checkpointing and check that the results match
docstr_tok: ["Run","SWAV","architecture","with","DDP","or","with","FSDP","with","or","without","activation","checkpointing","and","check","that","the","results","match"]
code: def test_regnet_fsdp_convergence_on_swav_with_larc(self) -> None:
      """
      Run SWAV architecture with DDP or with FSDP with or without
      activation checkpointing and check that the results match
      """
      with with_temp_files(count=2) as file_names:
          self.run_pretraining(
              with_fsdp=False,
              with_checkpointing=False,
              with_larc=True,
              output_file_name=file_names[0],
          )
          self.run_pretraining(
              with_fsdp=True,
              with_checkpointing=False,
              with_larc=True,
              output_file_name=file_names[1],
          )
  
          results = []
          for file_name in file_names:
              with open(file_name, "rb") as f:
                  result = pickle.load(f)
                  # TODO (Quentin) - figure out why it diverges slightly after a while
                  result[3] = round(result[3], 5)
                  result[4] = round(result[4], 4)
                  results.append(result)
  
          self.assertEqual(
              len(results[0]),
              len(results[1]),
              "DDP vs FSDP (LARC) Loss Lengths",
          )
  
          for i, ddp_result in enumerate(results[0]):
              fsdp_result = results[1][i]
              self.assertAlmostEqual(ddp_result, fsdp_result, places=4)
  
file_path: vissl/tests/test_regnet_fsdp.py
imports: import pickle
  import unittest
  import torch
  import torch.multiprocessing
  from classy_vision.optim import build_optimizer
  from torch.nn.parallel import DistributedDataParallel
  from vissl.losses.swav_loss import SwAVLoss
  from vissl.models import build_model
  from vissl.optimizers import *
  from vissl.utils.fsdp_utils import fsdp_wrapper
  from vissl.utils.hydra_config import compose_hydra_configuration, convert_to_attrdict
  from vissl.utils.test_utils import gpu_test, init_distributed_on_file, with_temp_files
label_desc: Use image node_id 5 for calling the TestRegnetFSDP obj's underlying member method code with example usage: obj.test_regnet_fsdp_convergence_on_swav_with_larc() without return types