Downloads · 30 days
7
1% of all-time downloads
Rachneet/T5-large-esnli-impli-figurative
T5-large-esnli-impli-figurative is a machine learning model from Rachneet. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
figurative hypothesis: I was gone for only a few days and my considerate adult son just let the sink fill up with dirty dishes, making me feel really happy premise: I left my adult son home for a few days and just cam…
Downloads · 30 days
7
1% of all-time downloads
All-time downloads
566
Public
Parameters
738M
5.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin3 GB · 50%
From the Hugging Face model README
from transformers import (
AutoTokenizer,
AutoConfig,
AutoModelForSeq2SeqLM
)
model_path = "T5-large-esnli-impli-figurative"
tokenizer = AutoTokenizer.from_pretrained(model_path)
config = AutoConfig.from_pretrained(model_path)
model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
premise = "I just caught a guy picking up used chewing gum and he put it in his mouth."
hypothesis = "it was such a pleasant sight to see a guy picking up used chewing gum; and he put it in his mouth"
prepared_input = f"figurative hypothesis: {hypothesis} premise: {premise}"
features = tokenizer(prepared_input, max_length=128, padding="max_length", truncation=True, return_tensors="pt")
model.eval()
model.to(device)
with torch.no_grad():
# https://huggingface.co/blog/how-to-generate
generated_ids = model.generate(
**features,
max_length=128,
use_cache=True,
num_beams=4,
length_penalty=0.6,
early_stopping=True,
)
dec_preds = tokenizer.decode(outputs[0], skip_special_tokens=True)
print("The prediction is: ", dec_preds)
print(dec_preds[1:].replace("explanation:", "").lstrip())
figurative hypothesis: I was gone for only a few days and my considerate adult son just let the sink fill up with dirty dishes, making me feel really happy premise: I left my adult son home for a few days and just came back to a sink full of gross old dishes.