code: def extract_momentum_encoder(input_path: str, output_path: str):
      # Load the checkpoint
      setup_path_manager()
      with g_pathmgr.open(input_path, "rb") as f:
          input_cp = torch.load(f, map_location="cpu")
  
      # Dispatch the extraction depending on checkpoint type
      checkpoint_type = input_cp.get(
          "type", CheckpointItemType.consolidated.name
      )
      if checkpoint_type == CheckpointItemType.consolidated.name:
          DINOCheckpointUtils.extract_teacher_from_consolidated_checkpoint(
              input_cp, output_path
          )
      elif checkpoint_type == CheckpointItemType.shard_list.name:
          DINOCheckpointUtils.extract_teacher_from_sharded_checkpoint(
              input_path, output_path
          )
  
imports: import argparse
  import torch
  from iopath.common.file_io import g_pathmgr
  from vissl.utils.checkpoint import CheckpointItemType, DINOCheckpointUtils
  from vissl.utils.env import setup_path_manager
label_desc: Use image node_id 2 for calling a global function with example usage: extract_momentum_encoder(input_path, output_path) without return types