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")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("answerdotai/ModernBERT-base") model = AutoModelForMaskedLM.from_pretrained("answerdotai/ModernBERT-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Mention that users should use transformers v4.48.0 (#50)
Browse files- Mention that users should use transformers v4.48.0 (a0ecef8b3e6d35d24a564a2e2b9105e79440931b)
Co-authored-by: Tom Aarsen <tomaarsen@users.noreply.huggingface.co>
43 unmodified lines4445464748495051525343 unmodified lines## UsageYou can use these models directly with the `transformers` library. Until the next `transformers` release, doing so requires installing transformers from main:```shpip install git+https://github.com/huggingface/transformers.git```Since ModernBERT is a Masked Language Model (MLM), you can use the `fill-mask` pipeline or load it via `AutoModelForMaskedLM`. To use ModernBERT for downstream tasks like classification, retrieval, or QA, fine-tune it following standard BERT fine-tuning recipes.43 unmodified lines4445464748495051525343 unmodified lines## UsageYou can use these models directly with the `transformers` library starting from v4.48.0:```shpip install -U transformers>=4.48.0```Since ModernBERT is a Masked Language Model (MLM), you can use the `fill-mask` pipeline or load it via `AutoModelForMaskedLM`. To use ModernBERT for downstream tasks like classification, retrieval, or QA, fine-tune it following standard BERT fine-tuning recipes.
README.md+2-2