-
Notifications
You must be signed in to change notification settings - Fork 30.7k
Add eurobert #39455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add eurobert #39455
Conversation
…t from PreTrainModel.
… information and typo in docs
…n and remove unneeded comment
…ion mask condition
…te related documentation
[For maintainers] Suggested jobs to run (before merge) run-slow: auto, eurobert |
@ArthurZucker What's the status here? Would love to get this fully out, also so we can add ONNX support for EuroBERT: huggingface/optimum#2321
|
Got caught up in the release I just needed to add integration tests making sure it works well! |
# This variable is used to determine which CUDA device are we using for our runners (A10 or T4) | ||
# Depending on the hardware we get different logits / generations | ||
cuda_compute_capability_major_version = None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from transformers import AutoTokenizer, AutoModelForMaskedLM
model_id = "EuroBERT/EuroBERT-2.1B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForMaskedLM.from_pretrained(model_id, trust_remote_code=True)
text = "The capital of France is <|mask|>."
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
# To get predictions for the mask:
masked_index = inputs["input_ids"][0].tolist().index(tokenizer.mask_token_id)
predicted_token_id = outputs.logits[0, masked_index].argmax(axis=-1)
predicted_token = tokenizer.decode(predicted_token_id)
print("Predicted token:", predicted_token)
# Predicted token: Paris
will run this with trust remote code
What does this PR do?