docstr: Special vocab which is not really vocabulary but instead a model
  which returns embedding directly instead of vocabulary. This is just
  an abstraction over a model which generates embeddings directly.
  For e.g. for fasttext model we encapsulate it inside this and provide
  it as a vocab so that the API of the vocab remains same.
  
  NOTE: stoi's functionality will remain same but it is actually calling
  a function to get word vectors. Currently, only fasttext is supported.
  
  Parameters
  ----------
  name : str
      Name of the embedding model which this vocab currently is loading
  model_file : str
      File from which model will be loaded. This API might need to be
      changed in future.
docstr_tok: ["Special","vocab","which","is","not","really","vocabulary","but","instead","a","model","which","returns","embedding","directly","instead","of","vocabulary",".","This","is","just","an","abstraction","over","a","model","which","generates","embeddings","directly",".","For","e.g",".","for","fasttext","model","we","encapsulate","it","inside","this","and","provide","it","as","a","vocab","so","that","the","API","of","the","vocab","remains","same",".","NOTE",":","stoi","'s","functionality","will","remain","same","but","it","is","actually","calling","a","function","to","get","word","vectors",".","Currently",",","only","fasttext","is","supported",".","Parameters","--","--","--","--","--","name",":","str","Name","of","the","embedding","model","which","this","vocab","currently","is","loading","model_file",":","str","File","from","which","model","will","be","loaded",".","This","API","might","need","to","be","changed","in","future","."]
code: def __init__(self, name, model_file, *args, **kwargs):
      """Special vocab which is not really vocabulary but instead a model
      which returns embedding directly instead of vocabulary. This is just
      an abstraction over a model which generates embeddings directly.
      For e.g. for fasttext model we encapsulate it inside this and provide
      it as a vocab so that the API of the vocab remains same.
  
      NOTE: stoi's functionality will remain same but it is actually calling
      a function to get word vectors. Currently, only fasttext is supported.
  
      Parameters
      ----------
      name : str
          Name of the embedding model which this vocab currently is loading
      model_file : str
          File from which model will be loaded. This API might need to be
          changed in future.
      """
      super().__init__(*args, **kwargs)
      self.type = "model"
      if name != "fasttext":
          raise ValueError(
              "Model vocab only supports fasttext as of now"
          )
      else:
          self._load_fasttext_model(model_file)
  
imports: import logging
  import os
  from collections import defaultdict
  import numpy
  import torch
  from mmf.utils.configuration import get_mmf_cache_dir
  from mmf.utils.distributed import is_main, synchronize
  from mmf.utils.file_io import PathManager
  from mmf.utils.general import get_absolute_path
  from torchtext import vocab
label_desc: Use image node_id 1 to create a new ModelVocab object from inherited base classes: BaseVocab with example: obj = ModelVocab(name, model_file)