Commit
·
4450b33
1
Parent(s):
f59555a
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
English-Simile-Generative is a seq2seq paraphrase model which can tranforme sentence A to sentence B containing figurative or simile expression.
|
2 |
+
|
3 |
+
A: I think I rated you very high at the beginning. Now I feel sad to see your scientific research progress is so slow.
|
4 |
+
|
5 |
+
B: I think I rated you very high at the beginning. Now I feel sad to see your scientific research progress is like a snail.
|
6 |
+
|
7 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained("figurative-nlp/English-Simile-Generation")
|
9 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("figurative-nlp/Ehinese-Simile-Generation")
|
10 |
+
|
11 |
+
|
12 |
+
input_ids = tokenizer(
|
13 |
+
"Adrenaline shot through him powerful", return_tensors="pt"
|
14 |
+
).input_ids
|
15 |
+
outputs = model.generate(input_ids,num_beams = 5,max_length = 64)
|
16 |
+
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
17 |
+
print(result)
|
18 |
+
#result : Adrenaline shot through him like an electric current
|