I use the following code to get the features of a given text in PyTorch.
from transformers import AlbertTokenizer, AlbertModel
tokenizer = AlbertTokenizer.from_pretrained('albert-base-v2')
model = AlbertModel.from_pretrained("albert-base-v2")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
The result of output is shown in the figure.
output consists of two tensor. Are they both the deep features of a given text ?
I use the following code to get the features of a given text in PyTorch.
The result of
output
is shown in the figure.output
consists of two tensor. Are they both the deep features of a given text ?