code: def __init__(
      self, glove_filepath: Union[Path, str], data: DatasetSplits
  ):
      words = data.vectorizer.data_vocab._token2id.keys()
  
      w2i, glove_embeddings = load_glove_from_file(
          glove_filepath=glove_filepath
      )
      embedding_size = glove_embeddings.shape[1]
  
      final_embeddings = np.zeros((len(words), embedding_size))
  
      for i, word in tqdm(
          enumerate(words),
          total=len(words),
          desc="Loading pre-trained word embeddings",
      ):
          if word in w2i:
              final_embeddings[i, :] = glove_embeddings[w2i[word]]
          else:
              embedding_i = torch.ones(1, embedding_size)
              torch.nn.init.xavier_uniform_(embedding_i)
              final_embeddings[i, :] = embedding_i
  
      self.embeddings = final_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 to create a new Embedding object  with example: obj = Embedding(glove_filepath, data)