code: def load_glove_from_file(
      glove_filepath: Path,
  ) -> Tuple[Dict[str, int], np.array]:
      w2i = {}
      embeddings = []
  
      with open(glove_filepath, "r") as fp:
          iterator = (
              tqdm(enumerate(fp), "Embeddings")
              if TQDM
              else enumerate(fp)
          )
          for index, line in iterator:
              line = line.split(" ")  # each line: word num1 num2 ...
              w2i[line[0]] = index  # word = line[0]
              embedding_i = np.array([float(val) for val in line[1:]])
              embeddings.append(embedding_i)
  
      return w2i, np.stack(embeddings)
  
file_path: transfer-nlp/transfer_nlp/embeddings/embeddings.py
imports: import logging
  from pathlib import Path
  from typing import Dict, Tuple, Union
  import numpy
  import torch
  from smart_open import open
  from transfer_nlp.loaders.loaders import DatasetSplits
  from transfer_nlp.plugins.config import register_plugin
  from transfer_nlp.plugins.helpers import ObjectHyperParams
label_desc: Use image node_id 1 for calling a global function with example usage: load_glove_from_file(glove_filepath) and returns: w2i,  np