figurative-nlp commited on
Commit
57892b4
1 Parent(s): 94b95cc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -1
README.md CHANGED
@@ -1,4 +1,20 @@
1
- This model can convert the literal expression to figurative/metaphorical expression.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  For example (the <m> and </m> is the mark that inform the model which literal expression we want to convert it as figurative expression):
4
 
 
1
+ This model can convert the literal expression to figurative/metaphorical expression. Below is the usage of our model:
2
+
3
+
4
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
5
+
6
+ tokenizer = AutoTokenizer.from_pretrained("figurative-nlp/t5-figurative-generation")
7
+ model = AutoModelForSeq2SeqLM.from_pretrained("figurative-nlp/t5-figurative-generation")
8
+
9
+
10
+ input_ids = tokenizer(
11
+ "research is <m> very difficult </m> for me.", return_tensors="pt"
12
+ ).input_ids # Batch size 1
13
+ outputs = model.generate(input_ids,beam_search = 5)
14
+ result = tokenizer.decode(outputs[0], skip_special_tokens=True)
15
+ #result : research is a tough nut to crack for me.
16
+
17
+
18
 
19
  For example (the &lt;m&gt; and &lt;/m&gt; is the mark that inform the model which literal expression we want to convert it as figurative expression):
20