code: def create_model(
      with_fsdp, with_checkpoint, model_hidden_dim, fsdp_config
  ):
      model = Model(model_hidden_dim)
      if with_fsdp:
          model.stem = auto_wrap_bn(model.stem, single_rank_pg=False)
          model.blocks = auto_wrap_bn(
              model.blocks, single_rank_pg=False
          )
          if with_checkpoint:
              model.blocks = checkpoint_wrapper(model.blocks)
          model.stem = to_fsdp(model.stem, fsdp_config)
          model.blocks = to_fsdp(model.blocks, fsdp_config)
          model.head = to_fsdp(model.head, fsdp_config)
      else:
          if with_checkpoint:
              model.blocks = checkpoint_wrapper(model.blocks)
      return model
  
imports: import contextlib
  import pytest
  import torch
  import torch.multiprocessing
  import torch.nn
  from torch.nn.parallel import DistributedDataParallel
  import torch.optim
  from fairscale.fair_dev.testing.testing import dist_init, dump_all_tensors, skip_if_single_gpu, teardown, temp_files_ctx
  from fairscale.internal import torch_version
  from fairscale.internal.parallel import get_process_group_cached
  from fairscale.nn import checkpoint_wrapper
  from fairscale.nn.data_parallel import FullyShardedDataParallel
  from fairscale.nn.data_parallel import auto_wrap_bn
label_desc: Use image node_id 3 for calling a global function with example usage: create_model(with_fsdp, with_checkpoint, model_hidden_dim, fsdp_config) and returns: model