Commit
·
2ea844f
1
Parent(s):
7757033
Update README.md
Browse files
README.md
CHANGED
@@ -27,8 +27,8 @@ 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 |
```
|
|
|
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", truncation_strategy="only_first", max_length=512)
|
31 |
+
output = model(input["input_ids"].to(device))['logits'][:,0] # device = "cuda:0" or "cpu"
|
32 |
prediction = torch.sigmoid(output).tolist()
|
33 |
print(prediction)
|
34 |
```
|