code: def upgrade_state_dict_named(self, state_dict, name):
      prefix = name + "." if name != "" else ""
      super().upgrade_state_dict_named(state_dict, name)
      old_keys = list(state_dict.keys())
  
      # rename decoder -> encoder before upgrading children modules
      for k in old_keys:
          if k.startswith(prefix + "encoder.lm_head"):
              state_dict.pop(k)
              continue
          new_k = k
          new_k = new_k.replace(".sentence_encoder.", ".")
          new_k = new_k.replace(
              "decoder.lm_head.", "decoder.output_projection."
          )
          if k == new_k:
              continue
          # print(k, "->", new_k)
          state_dict[new_k] = state_dict.pop(k)
  
file_path: fairseq/fairseq/models/roberta/enc_dec.py
imports: import argparse
  import logging
  import torch.nn
  import fairseq.checkpoint_utils
  from fairseq.models import FairseqEncoderDecoderModel, register_model, register_model_architecture
  from fairseq.models.transformer import TransformerDecoder
  from fairseq.models.roberta import model
label_desc: Use image node_id 5 for calling the RobertaEncDecModel obj's underlying member method code with example usage: obj.upgrade_state_dict_named(state_dict, name) without return types