Instructions to use answerdotai/ModernBERT-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use answerdotai/ModernBERT-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="answerdotai/ModernBERT-base")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("answerdotai/ModernBERT-base") model = AutoModelForMaskedLM.from_pretrained("answerdotai/ModernBERT-base") - Notebooks
- Google Colab
- Kaggle
How to use ModernBERT with the AutoModelForQuestionAnswering class?
I wanted to fine tune the model on the SQUAD dataset. But currently AutoModelForQuestionAnswering does not work with ModernBERT. Is there a workaround for the moment where I can train ModernBERT for QA tasks given a context?
Hey! This is planned, but indeed missing at the moment.
cc @NohTow @bwarner @wgpubs @tomaarsen , we should ensure our January update includes the missing heads (QA, MultipleChoice)
Thank you very much for ModernBERT!
@bclavie It will be amazing to have TokenClassification also. : )
@bclavie @NohTow @bwarner @wgpubs @tomaarsen Can you check if this script implements the ModernBertForQuestionAnswering correctly, and if so, copy the script into your repo here and the large version? Then we would be able to use the models for that if we enable trust_remote_code π