code: def get_glove_weights(vocabulary: Vocab, dim=300):
      glove = vocab.GloVe(name="6B", dim=dim)
      vocab_size = vocabulary.get_vocab_size()
      weight = torch.randn(vocab_size, dim)
      for i, word in enumerate(vocabulary.index2word):
          glove_rep = glove.get_vecs_by_tokens(word)
          weight[i, :] = glove_rep
      return weight
  
file_path: graph4nlp/examples/pytorch/nmt/utils.py
imports: import logging
  import math
  import os
  import pickle
  import torch
  import torchtext.vocab
  from torch.optim.lr_scheduler import LambdaLR
  from graph4nlp.pytorch.modules.utils.vocab_utils import Vocab
label_desc: Use image node_id 3 for calling a global function with example usage: get_glove_weights(vocabulary, dim) and returns: weight