Instructions to use answerdotai/ModernBERT-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use answerdotai/ModernBERT-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="answerdotai/ModernBERT-large")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("answerdotai/ModernBERT-large") model = AutoModelForMaskedLM.from_pretrained("answerdotai/ModernBERT-large") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -39,7 +39,13 @@ It is available in the following sizes:
|
|
| 39 |
|
| 40 |
## Usage
|
| 41 |
|
| 42 |
-
You can use these models directly with the `transformers` library.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
**⚠️ We strongly suggest using ModernBERT with Flash Attention 2, as it is by far the best performing variant of the model. To do so, install Flash Attention as follows, then use the model as normal:**
|
| 45 |
|
|
|
|
| 39 |
|
| 40 |
## Usage
|
| 41 |
|
| 42 |
+
You can use these models directly with the `transformers` library. Until the next `transformers` release, doing so requires installing transformers from main:
|
| 43 |
+
|
| 44 |
+
```sh
|
| 45 |
+
pip install git+https://github.com/huggingface/transformers.git
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
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.
|
| 49 |
|
| 50 |
**⚠️ We strongly suggest using ModernBERT with Flash Attention 2, as it is by far the best performing variant of the model. To do so, install Flash Attention as follows, then use the model as normal:**
|
| 51 |
|