Downloads · 30 days
21
1% of all-time downloads
lucadiliello/bleurt-tiny-128
bleurt-tiny-128 is a text classification model from lucadiliello. Use it when you need a label for a piece of text. It is set up for transformers.
This model is based on a custom Transformer model that can be installed with:
Downloads · 30 days
21
1% of all-time downloads
All-time downloads
3.7K
Public
Repo size
35.1 MB
Likes
0
Public
Click a slice to open those files.
.bin17.6 MB · 95%
From the Hugging Face model README
This model is based on a custom Transformer model that can be installed with:
pip install git+https://github.com/lucadiliello/bleurt-pytorch.git
Now load the model and make predictions with:
import torch
from bleurt_pytorch import BleurtConfig, BleurtForSequenceClassification, BleurtTokenizer
config = BleurtConfig.from_pretrained('lucadiliello/bleurt-tiny-128')
model = BleurtForSequenceClassification.from_pretrained('lucadiliello/bleurt-tiny-128')
tokenizer = BleurtTokenizer.from_pretrained('lucadiliello/bleurt-tiny-128')
references = ["a bird chirps by the window", "this is a random sentence"]
candidates = ["a bird chirps by the window", "this looks like a random sentence"]
model.eval()
with torch.no_grad():
inputs = tokenizer(references, candidates, padding='longest', return_tensors='pt')
res = model(**inputs).logits.flatten().tolist()
print(res)
# [0.7669461369514465, 0.6060263514518738]
Take a look at this repository for the definition of BleurtConfig, BleurtForSequenceClassification and BleurtTokenizer in PyTorch.