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
|
@@ -505,8 +505,9 @@ class BertEnergyModelForSequenceClassification(BertPreTrainedModel):
|
|
| 505 |
|
| 506 |
#self.dropout = nn.Dropout(dropout)
|
| 507 |
output_dim = config.hidden_size
|
| 508 |
-
|
| 509 |
-
self.
|
|
|
|
| 510 |
|
| 511 |
self.post_init()
|
| 512 |
|
|
|
|
| 505 |
|
| 506 |
#self.dropout = nn.Dropout(dropout)
|
| 507 |
output_dim = config.hidden_size
|
| 508 |
+
embed_dim = config.embedding_dim
|
| 509 |
+
self.norm = nn.LayerNorm(config.embedding_dim, eps=config.layer_norm_eps)
|
| 510 |
+
self.classifier = nn.Linear(config.embedding_dim, num_labels)
|
| 511 |
|
| 512 |
self.post_init()
|
| 513 |
|