Instructions to use chandar-lab/NeoBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chandar-lab/NeoBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="chandar-lab/NeoBERT", trust_remote_code=True)# Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("chandar-lab/NeoBERT", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update model.py
Browse filesAdd default value to return_dict if not passed.
model.py
CHANGED
|
@@ -378,7 +378,8 @@ class NeoBERTForSequenceClassification(NeoBERTPreTrainedModel):
|
|
| 378 |
labels: Optional[torch.Tensor] = None,
|
| 379 |
return_dict: Optional[bool] = None,
|
| 380 |
):
|
| 381 |
-
|
|
|
|
| 382 |
output = self.model.forward(
|
| 383 |
input_ids=input_ids,
|
| 384 |
position_ids=position_ids,
|
|
|
|
| 378 |
labels: Optional[torch.Tensor] = None,
|
| 379 |
return_dict: Optional[bool] = None,
|
| 380 |
):
|
| 381 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 382 |
+
|
| 383 |
output = self.model.forward(
|
| 384 |
input_ids=input_ids,
|
| 385 |
position_ids=position_ids,
|