code: def get_vocabs(dict_path):
      model = torch.load(dict_path, map_location=torch.device("cpu"))
      vocabs = dict_to_vocabs(model["vocab"])
  
      enc_vocab = vocabs["src"]
      dec_vocab = vocabs["tgt"]
  
      logger.info("From: %s" % dict_path)
      logger.info("\t* source vocab: %d words" % len(enc_vocab))
      logger.info("\t* target vocab: %d words" % len(dec_vocab))
  
      return enc_vocab, dec_vocab
  
file_path: OpenNMT-py/tools/embeddings_to_torch.py
imports: from __future__ import division
  import six
  import argparse
  import torch
  from onmt.utils.logging import init_logger, logger
  from onmt.inputters.inputter import dict_to_vocabs
label_desc: Use image node_id 1 for calling a global function with example usage: get_vocabs(dict_path) and returns: enc_vocab,  dec_vocab