File size: 862 Bytes
626654f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
---
language: en
license: mit
tags:
- cross-encoder
- text-similarity
- text-classification
---
## Usage
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("TrishanuDas/CE-7_512_MSELoss")
# Load model weights
model = AutoModelForSequenceClassification.from_pretrained("TrishanuDas/CE-7_512_MSELoss")
# Prepare input
inputs = tokenizer("Query", "Document", return_tensors="pt", padding=True, truncation=True)
# Get prediction
with torch.no_grad():
# Get logits
outputs = model(**inputs)
logits = outputs.logits
# Apply sigmoid to get probabilities
scores = torch.sigmoid(logits)
```
## Important Note
When loading this model, you need to manually apply the sigmoid function to the logits as shown in the example above.
|