Instructions to use lucadiliello/bleurt-base-512 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lucadiliello/bleurt-base-512 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="lucadiliello/bleurt-base-512")# Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("lucadiliello/bleurt-base-512", dtype="auto") - Notebooks
- Google Colab
- Kaggle
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
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-base-512')
model = BleurtForSequenceClassification.from_pretrained('lucadiliello/bleurt-base-512')
tokenizer = BleurtTokenizer.from_pretrained('lucadiliello/bleurt-base-512')
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)
# [1.1482683420181274, 0.7443546056747437]
Take a look at this repository for the definition of BleurtConfig, BleurtForSequenceClassification and BleurtTokenizer in PyTorch.
- Downloads last month
- 14