code: def load_embedding_vectors(embedding_file, vocab):
      f = io.open(embedding_file, "rt", encoding="utf-8").readlines()
  
      words_transformed = set()
      repetitions = 0
      embeddings_dimensionality = None
      vectors = {}
  
      for line in tqdm(f, desc="Loading embeddings"):
          line = line.strip()
          if line:
              word, vec = line.split(" ", 1)
              if (
                  word not in words_transformed
              ):  # omit repetitions = speed up + debug
                  try:
                      np_vec = np.fromstring(vec, sep=" ")
                      if embeddings_dimensionality is None:
                          if (
                              len(np_vec) < 4
                          ):  # word2vec includes number of vectors and its dimension as header
                              logger.info("Skipping header")
                              continue
                          else:
                              embeddings_dimensionality = len(np_vec)
                      if len(np_vec) == embeddings_dimensionality:
                          vectors[word] = np_vec
                          words_transformed.add(word)
                  except:
                      if logger is not None:
                          logger.debug(
                              "Embeddings reader: Could not convert line: {}".format(
                                  line
                              )
                          )
              else:
                  repetitions += 1
  
      embeddings = np.zeros((len(vocab), embeddings_dimensionality))
      for i, w in enumerate(vocab):
          current = vectors.get(w, np.zeros(embeddings_dimensionality))
          if w not in vectors:
              logger.warning(
                  f"Could not load pretrained embedding for word: {w}"
              )
          embeddings[i, :] = current
      return embeddings
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import io
  import json
  import logging
  import os
  import unicodedata
  from pathlib import Path
  import numpy
  import pandas
  from tqdm import tqdm
  from transformers import BertTokenizer
  from sklearn.decomposition import TruncatedSVD
  from sklearn.cluster import KMeans
  from collections import Counter
  from farm.file_utils import load_from_cache
label_desc: Use image node_id 3 for calling a global function with example usage: load_embedding_vectors(embedding_file, vocab) and returns: embeddings