Convert torch.nn.Embedding layer to numpy array
bert_embeddings = bert_model.get_input_embeddings()
# Convert bert embeddings from a torch.nn.Module type to a numpy array
bert_embedding_numpy = np.array(bert_embeddings.weight.data)
Convert torch.nn.Embedding layer to numpy array
bert_embeddings = bert_model.get_input_embeddings()
# Convert bert embeddings from a torch.nn.Module type to a numpy array
bert_embedding_numpy = np.array(bert_embeddings.weight.data)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us