code: def convert_checkpoint_to_params(
      model_config_fname: str,
      checkpoint_dirname: str,
      params_fname: str,
  ):
      # Create a temporary SockeyeModel
      model_config = model.SockeyeModel.load_config(model_config_fname)
      sockeye_model = model.SockeyeModel(model_config)
      # Gather the float32 params on CPU
      state_dict = dict(
          get_fp32_state_dict_from_zero1_checkpoint(checkpoint_dirname)
      )
      # Strip the first prefix from each param name to match the SockeyeModel
      # Ex: 'model.encoder.layers...' -> 'encoder.layers...'
      state_dict = {
          name[name.find(".") + 1 :]: param
          for (name, param) in state_dict.items()
      }
      # Load the float32 params. Use non-strict mode because shared and constant
      # params are not included in the DeepSpeed-generated state dict.
      sockeye_model.load_state_dict(state_dict, strict=False)
      # Save the float32 params to disk
      sockeye_model.save_parameters(params_fname)
      # Cleanup
      del sockeye_model
      gc.collect()
  
file_path: sockeye/sockeye/convert_deepspeed.py
imports: import argparse
  import collections
  import gc
  import logging
  import os
  import shutil
  import torch
  from .None import constants
  from .None import log
  from .None import model
  from .None import utils
label_desc: Use image node_id 2 for calling a global function with example usage: convert_checkpoint_to_params(model_config_fname, checkpoint_dirname, params_fname) without return types