code: def format_word_embeddings(word_vecfile, word2id_file, np_file):
      with open(word2id_file, "rb") as rd:
          word2id = pickle.load(rd)
      wordcnt = len(word2id)
  
      word_embeddings = None
      line_idx = 0
      with open(word_vecfile, "r", encoding="utf-8") as rd:
          while True:
              line = rd.readline()
              if not line:
                  break
              words = line.strip().split()
              line_idx += 1
              if line_idx == 1:
                  _wordcnt, _emb_size = int(words[0]), int(words[1])
                  if (
                      _wordcnt + 1 != wordcnt
                  ):  #  the 0-th word is 'NULL'
                      raise ValueError(
                          "Word number doesn't match in word2id ({0}) and word2embedding file ({1})!".format(
                              wordcnt, _wordcnt
                          )
                      )
                  word_embeddings = np.zeros(
                      shape=(_wordcnt + 1, _emb_size), dtype=np.float32
                  )
              else:
                  _idx = word2id[words[0]]
                  for i in range(1, _emb_size + 1):
                      word_embeddings[_idx][i - 1] = float(words[i])
      with open(np_file, "wb") as f:
          np.save(f, word_embeddings)
  
imports: import codecs
  import pickle
  import time
  import os
  from datetime import datetime
  import random
  import numpy
  import math
  from multiprocessing import Process
  from utils.general import *
  from utils.data_helper import *
label_desc: Use image node_id 23 for calling a global function with example usage: format_word_embeddings(word_vecfile, word2id_file, np_file) without return types