code: def generate_embed(
      embed_path, text_vocab, embed_pickle_path, embed_size=300
  ):
      embeddings_dict = {}
      with open(embed_path, encoding="utf-8") as f:
          for line in f:
              try:
                  values = line.replace("\n", "").split()
                  word = values[0]
                  coefs = np.asarray(values[1:], dtype="float32")
                  embeddings_dict[word] = coefs
              except Exception as e:
                  print("\tException: ", e)
          embedding_matrix = np.zeros((len(text_vocab), embed_size))
  
          for word, i in text_vocab.items():
              if word in embeddings_dict:
                  embedding_matrix[int(i)] = embeddings_dict[word]
              else:
                  embedding_matrix[int(i)] = np.random.uniform(
                      -1, 1, embed_size
                  )
                  logging.info("out_of_vocabs {}".format(word))
          with open(embed_pickle_path, "ab+") as fp:
              pickle.dump(embedding_matrix, fp)
          logging.info(
              "embedding_matrix: {}".format(embedding_matrix.shape)
          )
          logging.info("finish generate embed")
  
file_path: delta/egs/iemocap/emo/v1/local/python/generate_vocab.py
imports: import sys
  import os
  import re
  import numpy
  from absl import logging
  from collections import defaultdict
  import pickle
label_desc: Use image node_id 2 for calling a global function with example usage: generate_embed(embed_path, text_vocab, embed_pickle_path, embed_size) without return types