code: def make_state_dict(converted_params, is_encoder_only: bool):
      """Prepares a state dict for the PyTorch model."""
      # Make a state dict with torch tensors.
      state_dict = collections.OrderedDict(
          [
              (k, torch.from_numpy(v.copy()))
              for (k, v) in converted_params.items()
          ]
      )
  
      # Add what is missing.
      if "encoder.embed_tokens.weight" not in state_dict:
          state_dict["encoder.embed_tokens.weight"] = state_dict[
              "shared.weight"
          ]
  
      if not is_encoder_only:
          if "decoder.embed_tokens.weight" not in state_dict:
              state_dict["decoder.embed_tokens.weight"] = state_dict[
                  "shared.weight"
              ]
  
          if "lm_head.weight" not in state_dict:  # For old 1.0 models.
              print("Using shared word embeddings as lm_head.")
              state_dict["lm_head.weight"] = state_dict["shared.weight"]
  
      return state_dict
  
file_path: transformers/src/transformers/models/umt5/convert_umt5_checkpoint_to_pytorch.py
imports: import argparse
  import collections
  import numpy
  import torch
  from flax import traverse_util
  from t5x import checkpoints
  from transformers import MT5Config, UMT5EncoderModel, UMT5ForConditionalGeneration
  from transformers.utils import logging
label_desc: Use image node_id 6 for calling a global function with example usage: make_state_dict(converted_params, is_encoder_only) and returns: state_dict