class_docstr: Train Transformer models for multiple language pairs simultaneously.
  
  Requires `--task multilingual_translation`.
  
  We inherit all arguments from TransformerModel and assume that all language
  pairs use a single Transformer architecture. In addition, we provide several
  options that are specific to the multilingual setting.
  
  Args:
      --share-encoder-embeddings: share encoder embeddings across all source languages
      --share-decoder-embeddings: share decoder embeddings across all target languages
      --share-encoders: share all encoder params (incl. embeddings) across all source languages
      --share-decoders: share all decoder params (incl. embeddings) across all target languages
code: def load_state_dict(self, state_dict, strict=True, model_cfg=None):
      state_dict_subset = state_dict.copy()
      for k, _ in state_dict.items():
          assert k.startswith("models.")
          lang_pair = k.split(".")[1]
          if lang_pair not in self.models:
              del state_dict_subset[k]
      super().load_state_dict(
          state_dict_subset, strict=strict, model_cfg=model_cfg
      )
  
file_path: fairseq/fairseq/models/multilingual_transformer.py
imports: from collections import OrderedDict
  from fairseq import utils
  from fairseq.models import FairseqMultiModel, register_model, register_model_architecture
  from fairseq.models.transformer import Embedding, TransformerDecoder, TransformerEncoder, TransformerModel, base_architecture
  from fairseq.utils import safe_hasattr
label_desc: Use image node_id 5 for calling the MultilingualTransformerModel obj's underlying member method code with example usage: obj.load_state_dict(state_dict, strict, model_cfg) without return types