text_plain_output_5.png application_vnd.jupyter.stderr_output_6.png text_plain_output_4.png text_plain_output_3.png text_plain_output_2.png text_plain_output_1.png
from transformers import AutoTokenizer, BertModel

import torch

from transformers import AutoTokenizer, BertModel
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
model = BertModel.from_pretrained('bert-base-uncased')

example_word = 'cyber'
example_token_id = tokenizer.convert_tokens_to_ids([example_word])[0]
example_embedding = model.embeddings.word_embeddings(torch.tensor([example_token_id]))
print(example_embedding.shape)
print(example_embedding)