Instructions to use TCMVince/HOP4NLP5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TCMVince/HOP4NLP5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="TCMVince/HOP4NLP5", trust_remote_code=True)# Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("TCMVince/HOP4NLP5", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update mlm.py
Browse files
mlm.py
CHANGED
|
@@ -497,7 +497,7 @@ class BertEnergyModelForSequenceClassification(BertPreTrainedModel):
|
|
| 497 |
def __init__(self, config, add_pooling_layer=True, pad_idx=None, classifier_dropout=0.1, num_labels=2):
|
| 498 |
super().__init__(config)
|
| 499 |
self.config = config
|
| 500 |
-
|
| 501 |
self.model = BertEnergyModel(config, pad_idx=pad_idx)
|
| 502 |
#self.lm_head = EnergyLMHead(config)
|
| 503 |
|
|
|
|
| 497 |
def __init__(self, config, add_pooling_layer=True, pad_idx=None, classifier_dropout=0.1, num_labels=2):
|
| 498 |
super().__init__(config)
|
| 499 |
self.config = config
|
| 500 |
+
self.num_labels = num_labels
|
| 501 |
self.model = BertEnergyModel(config, pad_idx=pad_idx)
|
| 502 |
#self.lm_head = EnergyLMHead(config)
|
| 503 |
|