File size: 1,391 Bytes
57892b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4041b5a
94b95cc
4c54b6f
94b95cc
4c54b6f
94b95cc
4041b5a
94b95cc
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
This model can convert the literal expression to figurative/metaphorical expression. Below is the usage of our model:


      from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
      
      tokenizer = AutoTokenizer.from_pretrained("figurative-nlp/t5-figurative-generation")
      model = AutoModelForSeq2SeqLM.from_pretrained("figurative-nlp/t5-figurative-generation")
      
      
      input_ids = tokenizer(
          "research is <m> very difficult </m> for me.", return_tensors="pt"
      ).input_ids  # Batch size 1
      outputs = model.generate(input_ids,beam_search = 5)
      result = tokenizer.decode(outputs[0], skip_special_tokens=True)
      #result : research is a tough nut to crack for me.



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):

   **Input**: as of a cloud that softly &lt;m&gt; covers &lt;/m&gt; the sun.
   
   **Output**: as of a cloud that softly drapes over the sun. 
   
   **Input**: that car coming around the corner &lt;m&gt; surprised me. &lt;/m&gt;
   
   **Output**: that car coming around the corner knocked my socks off.
   
   
 Note: the figurative language here includes metaphor, idiom and  simile. We don't guarantee that the results generated results are satisfactory to you. We are trying to improve the effect of the model.