nightdessert
commited on
Commit
•
8681b05
1
Parent(s):
e817f0f
Update README.md
Browse files
README.md
CHANGED
@@ -22,18 +22,14 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
22 |
import torch
|
23 |
|
24 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
25 |
-
model_name = "nightdessert
|
26 |
-
/
|
27 |
-
WeCheck "
|
28 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
29 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
30 |
-
premise = "I first thought that I liked the movie, but upon second thought it was actually disappointing."
|
31 |
-
hypothesis = "The movie was not good."
|
32 |
input = tokenizer(premise, hypothesis, truncation=True, return_tensors="pt")
|
33 |
-
output = model(input["input_ids"].to(device)) # device = "cuda:0" or "cpu"
|
34 |
-
prediction = torch.
|
35 |
-
label_names = ["entailment", "neutral", "contradiction"]
|
36 |
-
prediction = {name: round(float(pred) * 100, 1) for pred, name in zip(prediction, label_names)}
|
37 |
print(prediction)
|
38 |
|
39 |
license: openrail
|
|
|
22 |
import torch
|
23 |
|
24 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
25 |
+
model_name = "nightdessert/WeCheck"
|
|
|
|
|
26 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
27 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
28 |
+
premise = "I first thought that I liked the movie, but upon second thought it was actually disappointing." # Input for Summarization/ Dialogue / Paraphrase
|
29 |
+
hypothesis = "The movie was not good." # Output for Summarization/ Dialogue / Paraphrase
|
30 |
input = tokenizer(premise, hypothesis, truncation=True, return_tensors="pt")
|
31 |
+
output = model(input["input_ids"].to(device))[:,0] # device = "cuda:0" or "cpu"
|
32 |
+
prediction = torch.sigmoid(output).tolist()
|
|
|
|
|
33 |
print(prediction)
|
34 |
|
35 |
license: openrail
|