Instructions to use sgugger/my-bert-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sgugger/my-bert-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="sgugger/my-bert-model", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("sgugger/my-bert-model", trust_remote_code=True) model = AutoModel.from_pretrained("sgugger/my-bert-model", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
Merge branch 'main' of https://huggingface.co/sgugger/my-bert-model
Browse files- modeling.py +1 -1
modeling.py
CHANGED
|
@@ -2,5 +2,5 @@ from transformers import BertModel
|
|
| 2 |
|
| 3 |
class MyBertModel(BertModel):
|
| 4 |
def forward(self, *args, **kwargs):
|
| 5 |
-
print("
|
| 6 |
return super().forward(*args, **kwargs)
|
|
|
|
| 2 |
|
| 3 |
class MyBertModel(BertModel):
|
| 4 |
def forward(self, *args, **kwargs):
|
| 5 |
+
print("This is a custom model, whose codes leaves in https://huggingface.co/sgugger/my-bert-model/edit/main/modeling.py")
|
| 6 |
return super().forward(*args, **kwargs)
|