class_docstr: Transformer encoder model.
class_docstr_tok: ["Transformer","encoder","model","."]
docstr: Customized load.
docstr_tok: ["Customized","load","."]
code: def load_state_dict(self, state_dict, strict=True):
      """Customized load."""
  
      # Encoder.
      if self._model_key in state_dict:
          state_dict_ = state_dict[self._model_key]
      # for backward compatibility.
      elif "transformer" in state_dict:
          state_dict_ = state_dict["transformer"]
      else:
          # for backward compatibility.
          state_dict_ = {}
          for key in state_dict.keys():
              if "transformer." in key:
                  state_dict_[
                      key.split("transformer.")[1]
                  ] = state_dict[key]
  
      # for backward compatibility.
      state_dict_self_attention = {}
      for key in state_dict_.keys():
          if ".attention." in key:
              state_dict_self_attention[
                  key.replace(".attention.", ".self_attention.")
              ] = state_dict_[key]
          else:
              state_dict_self_attention[key] = state_dict_[key]
      state_dict_ = state_dict_self_attention
  
      self.model.load_state_dict(state_dict_, strict=strict)
  
file_path: NeMo/nemo/collections/nlp/modules/common/megatron/megatron_transformer_encoder.py
imports: from nemo.collections.nlp.modules.common.megatron.layer_type import LayerType
  from nemo.collections.nlp.modules.common.megatron.megatron_encoder_module import MegatronEncoderModule
  from nemo.collections.nlp.modules.common.megatron.module import MegatronModule
  from nemo.collections.nlp.modules.common.megatron.transformer import ParallelTransformer
  from nemo.collections.nlp.modules.common.megatron.utils import ApexGuardDefaults, attn_mask_postprocess, build_attention_mask_3d
  from nemo.core.classes.exportable import Exportable
label_desc: Use image node_id 5 for calling the MegatronTransformerEncoderModule obj's underlying member method code with example usage: obj.load_state_dict(state_dict, strict) without return types