svjack commited on
Commit
dcd3155
1 Parent(s): 279aa59

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -0
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - zh
4
+ library_name: transformers
5
+ pipeline_tag: text2text-generation
6
+ ---
7
+
8
+ ```python
9
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
10
+
11
+ tokenizer = AutoTokenizer.from_pretrained("svjack/T5-dialogue-collect-v5")
12
+
13
+ model = AutoModelForSeq2SeqLM.from_pretrained("svjack/T5-dialogue-collect-v5")
14
+
15
+ text = '''
16
+ 根据下面的上下文进行分段:
17
+ 上下文 他 喜欢 吃 汉堡 是 但 我 可 不 喜欢。
18
+ 答案:
19
+ '''
20
+
21
+ tokenizer.decode(
22
+ model.generate(
23
+ tokenizer.encode(
24
+ text, return_tensors="pt", add_special_tokens=True
25
+ ))[0],
26
+ skip_special_tokens = True
27
+ )
28
+
29
+ '''
30
+ '分段:他喜欢吃汉堡 分段:是的,但我可不喜欢。'
31
+ '''
32
+
33
+ ```