Why do I get different embeddings when I perform batch encoding in huggingface MT5 model?
I am trying to encode some text using HuggingFace's mt5-base model. I am using the model as shown below
from transformers import MT5EncoderModel, AutoTokenizer
model = MT5EncoderModel.from_pretrained("google/mt5-base")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-base")
def get_t5_embeddings(texts):
last_hidden_state = model(input_ids=tokenizer(texts, return_tensors="pt", padding=True).input_ids).last_hidden_state
pooled_sentence = torch.max(last_hidden_state, dim=1)...