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
|
@@ -545,8 +545,8 @@ class BertEnergyModelForSequenceClassification(BertPreTrainedModel):
|
|
| 545 |
)
|
| 546 |
|
| 547 |
def forward(self, input_ids, labels=None, return_dict=None, **kwargs):
|
| 548 |
-
if return_dict is None:
|
| 549 |
-
|
| 550 |
|
| 551 |
outputs = self.model(input_ids, attention_mask=attention_mask, **kwargs)
|
| 552 |
last_hidden_state = self.norm(outputs.last_hidden_state)
|
|
|
|
| 545 |
)
|
| 546 |
|
| 547 |
def forward(self, input_ids, labels=None, return_dict=None, **kwargs):
|
| 548 |
+
#if return_dict is None:
|
| 549 |
+
# return_dict = self.return_dict
|
| 550 |
|
| 551 |
outputs = self.model(input_ids, attention_mask=attention_mask, **kwargs)
|
| 552 |
last_hidden_state = self.norm(outputs.last_hidden_state)
|