figurative-nlp commited on
Commit
67660b5
·
1 Parent(s): 8202a4e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -12
README.md CHANGED
@@ -3,15 +3,15 @@ chinese-simile-generative 是一个将句子A改写成带有修辞手法(主要
3
  A: 我走得很慢,慢极了。
4
  B: 我走的很慢,像蜗牛一样。
5
 
6
- from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
7
- tokenizer = AutoTokenizer.from_pretrained("figurative-nlp/chinese-simile-generation")
8
- model = AutoModelForSeq2SeqLM.from_pretrained("figurative-nlp/chinese-simile-generation")
9
-
10
-
11
- input_ids = tokenizer(
12
- "我走得很慢,慢极了", return_tensors="pt"
13
- ).input_ids
14
- outputs = model.generate(input_ids,num_beams = 5,max_length = 64)
15
- result = tokenizer.decode(outputs[0], skip_special_tokens=True)
16
- print(result)
17
- #result : 我走的很慢,像蜗牛一样。
 
3
  A: 我走得很慢,慢极了。
4
  B: 我走的很慢,像蜗牛一样。
5
 
6
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
7
+ tokenizer = AutoTokenizer.from_pretrained("figurative-nlp/chinese-simile-generation")
8
+ model = AutoModelForSeq2SeqLM.from_pretrained("figurative-nlp/chinese-simile-generation")
9
+
10
+
11
+ input_ids = tokenizer(
12
+ "我走得很慢,慢极了", return_tensors="pt"
13
+ ).input_ids
14
+ outputs = model.generate(input_ids,num_beams = 5,max_length = 64)
15
+ result = tokenizer.decode(outputs[0], skip_special_tokens=True)
16
+ print(result)
17
+ #result : 我走的很慢,像蜗牛一样。