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
Commit History
-
Set tokenizer "model_max_length" property to 8192 (#39)
Verified signature- Set tokenizer "model_max_length" property to 8192 (9e1cd05c51ed0a9a9a94ac6e51ccb76ed6d6f3ae) Co-authored-by: Antoine Chaffin <[email protected]>8949b90 -
Mention that users should use transformers v4.48.0 (#50)
Verified signature- Mention that users should use transformers v4.48.0 (a0ecef8b3e6d35d24a564a2e2b9105e79440931b) Co-authored-by: Tom Aarsen <[email protected]>ae3cb1e
-
undo last commit
Verified signature94032bb -
Add `"add_prefix_space": true,`; this allows for much stronger token-level performance (e.g. NER, ColBERT) (#48)
Verified signature- Add `"add_prefix_space": true,`; this allows for much stronger token-level performance (e.g. NER, ColBERT) (f6df40d17e86f214aa10ebba19c5f847a27a2f99) Co-authored-by: Tom Aarsen <[email protected]>b7cc329
-
Update README.md
Verified signature6e46162
-
Bump `max_position_embeddings` to 8192
Verified signaturealso harmonize `layer_norm_eps` with `norm_eps` although the former isn't used5756c58 -
Add links to answer.ai & lighton.ai
Verified signature1e8d430 -
Fix typo
Verified signaturea31ab76 -
Add "If your GPU supports it, "
Verified signaturef967537 -
Upload ONNX weights (#1)
Verified signature- Upload ONNX weights (53c8c1c657edc6f6c790b74a261010398f40be0e) Co-authored-by: Joshua <[email protected]>6d46980 -
Update snippet slightly
Verified signaturec480c3f -
Strongly suggest -> Recommend
Verified signaturefec8a7d -
Remove now unused unpad_no_grad
Tom Aarsenfa3113d -
Update README.md
Verified signatureba9fd55 -
Update README.md
Verified signature8eb54e3 -
Update README.md
Verified signature9a76b05
-
Update README.md
Verified signaturee5629bf -
Update README.md
Verified signature11aa1a9 -
Create README.md
Verified signature890363e
-
Purge duplicate "decoder.weight", rely on tied weights instead
Tom Aarsenc0e4443 -
Also update tokenizer/special_tokens_map
Tom Aarsen2b01747 -
Update tokenizer: Set lstrip=True for [MASK]
Tom AarsenThis allows mask filling with e.g. "The dog [MASK]", whereas that otherwise didn't work as most tokens start with a space in our tokenizer. The model doesn't use double spaces, so it would give odd results like "urn".51c9b61
-
Remove now-unused parameters
Tom Aarsen6a07d13 -
Remove the classifier norm
Tom Aarsenaf72838
-
Remove unpad_inputs for now
Tom AarsenShould depending on user's attn_implementation instead1a13461
-
Update the arch: ModernBertModel to ModernBertForMaskedLM
Tom Aarsen290243f -
Upload ModernBERT-base model
Tom Aarsencb3183f -
initial commit
Verified signature3f5ebe1