code: def add_secial_tokens_to_dict_and_model(
      dictionary: "fairseq.data.Dictionary",
      model: nn.Module,
      mono_langs: Sequence[str],
  ) -> None:
      embs = model.encoder.embed_tokens
      vocab_size, embedding_dim = embs.weight.shape
  
      # The model may or may not have a '<mask>' embedding yet
      assert (
          len(dictionary) <= vocab_size <= len(dictionary) + 1
      ), f"Dictionary len ({len(dictionary)}) doesn't match embs shape ({embs.weight.shape})"
      # TODO: we should reuse the pretrained model dict which already has <mask>
      dictionary.add_symbol("<mask>")
  
      for lang in mono_langs:
          lang_token = _lang_token(lang)
          dictionary.add_symbol(lang_token)
      logger.info(
          f"dictionary: {len(dictionary)} -> {vocab_size} tokens "
          f"after adding {len(mono_langs)} lang tokens."
      )
  
      if len(dictionary) <= vocab_size:
          return
  
      extend_embedding(embs, len(dictionary), dictionary.bos())
      dec_embs = model.decoder.embed_tokens
      extend_embedding(dec_embs, len(dictionary), dictionary.bos())
      lm_head = model.decoder.output_projection
      extend_embedding(lm_head, len(dictionary), dictionary.bos())
      assert lm_head.weight.shape == (len(dictionary), embedding_dim)
  
imports: import contextlib
  import json
  import logging
  import math
  import os
  from argparse import Namespace
  from collections import OrderedDict, defaultdict
  from pathlib import Path
  from typing import Dict, Sequence, Tuple
  from argparse import ArgumentError
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import fairseq
  from fairseq import options, utils
  from fairseq.logging import metrics
  from fairseq.data import FairseqDataset, LanguagePairDataset, NoisingDataset, PrependTokenDataset, RoundRobinZipDatasets, TransformEosLangPairDataset, data_utils, encoders
  from fairseq.sequence_generator import SequenceGenerator
  from fairseq.tasks import register_task
  from fairseq.tasks.translation import TranslationTask, load_langpair_dataset
label_desc: Use image node_id 2 for calling a global function with example usage: add_secial_tokens_to_dict_and_model(dictionary, model, mono_langs) without return types