code: def convert_and_save_model(args, replace_prefix):
      assert g_pathmgr.exists(
          args.output_dir
      ), "Output directory does NOT exist"
  
      # load the model
      model_path = args.model_url_or_file
      if is_url(model_path):
          logger.info(f"Loading from url: {model_path}")
          model = load_state_dict_from_url(model_path)
      else:
          model = torch.load(
              model_path, map_location=torch.device("cpu")
          )
  
      # get the model trunk to rename
      if "classy_state_dict" in model.keys():
          model_trunk = model["classy_state_dict"]["base_model"][
              "model"
          ]["trunk"]
      elif "model_state_dict" in model.keys():
          model_trunk = model["model_state_dict"]
      else:
          model_trunk = model
      logger.info(
          f"Input model loaded. Number of params: {len(model_trunk.keys())}"
      )
  
      # convert the trunk
      converted_model = replace_module_prefix(
          model_trunk, "_feature_blocks."
      )
      logger.info(
          f"Converted model. Number of params: {len(converted_model.keys())}"
      )
  
      # save the state
      if args.output_name.endswith(".torch"):
          output_filename = f"converted_vissl_{args.output_name}"
      else:
          output_filename = f"converted_vissl_{args.output_name}.torch"
      output_model_filepath = f"{args.output_dir}/{output_filename}"
      logger.info(f"Saving model: {output_model_filepath}")
      torch.save(converted_model, output_model_filepath)
      logger.info("DONE!")
  
file_path: vissl/extra_scripts/convert_vissl_to_torchvision.py
imports: import argparse
  import logging
  import sys
  import torch
  from iopath.common.file_io import g_pathmgr
  from vissl.utils.checkpoint import replace_module_prefix
  from vissl.utils.io import is_url
label_desc: Use image node_id 1 for calling a global function with example usage: convert_and_save_model(args, replace_prefix) without return types