| English-Simile-Generation is a seq2seq paraphrase model which can transform sentence A to sentence B containing figurative or simile expression. | |
| A: Now I feel sad to see your scientific research progress is so slow. | |
| B: Now I feel sad to see your scientific research progress is as slow as snail. | |
| **To our knowledge, our model have better performance,diversity and practicability compared to EMNLP21 paper (Generating similes effortlessly like a Pro: | |
| A Style Transfer Approach for Simile Generation). ** | |
| from transformers import AutoTokenizer, AutoModelForSeq2SeqLM | |
| tokenizer = AutoTokenizer.from_pretrained("figurative-nlp/English-Simile-Generation") | |
| model = AutoModelForSeq2SeqLM.from_pretrained("figurative-nlp/Ehinese-Simile-Generation") | |
| input_ids = tokenizer( | |
| "Adrenaline shot through him powerful", return_tensors="pt" | |
| ).input_ids | |
| outputs = model.generate(input_ids,num_beams = 5,max_length = 64) | |
| result = tokenizer.decode(outputs[0], skip_special_tokens=True) | |
| print(result) | |
| #result : Adrenaline shot through him like an electric current |