wawaup commited on
Commit
764e561
·
1 Parent(s): 75f4d08

data16w with emotion

Browse files
Files changed (8) hide show
  1. README.md +27 -1
  2. config.json +1 -1
  3. optimizer.pt +1 -1
  4. pytorch_model.bin +1 -1
  5. rng_state.pth +1 -1
  6. scheduler.pt +1 -1
  7. trainer_state.json +0 -0
  8. training_args.bin +2 -2
README.md CHANGED
@@ -9,4 +9,30 @@ metrics:
9
  - rouge
10
  ---
11
  ## 模型
12
- - 基于中文MengziT5的新闻评论生成模型
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  - rouge
10
  ---
11
  ## 模型
12
+ - 基于中文[MengziT5](https://huggingface.co/Langboat/mengzi-t5-base)的新闻评论生成模型
13
+ - 数据集来源于论文[《Coherent Comment Generation for Chinese Articles with a Graph-to-Sequence Model》](https://github.com/lancopku/Graph-to-seq-comment-generation)
14
+
15
+ ## 生成评论
16
+ - 在线API只能生成一种评论,模型通过设置model.generate()参数是可以生成多种评论的
17
+
18
+ ```Python
19
+
20
+ t5_tokenizer = T5Tokenizer.from_pretrained("Langboat/mengzi-t5-base")
21
+
22
+ model = T5ForConditionalGeneration.from_pretrained("wawaup/MengziT5-Comment")
23
+
24
+ def generate_comment(input_ids,cnt_num):
25
+ outputs = model.generate(input_ids,
26
+ max_length=128,
27
+ do_sample=True,
28
+ temperature=0.9,
29
+ early_stopping=True,
30
+ repetition_penalty=10.0,
31
+ top_p=0.5,
32
+ num_return_sequences=cnt_num)
33
+ print(outputs)
34
+ preds_cleaned = [t5_tokenizer.decode(ids, skip_special_tokens=True,
35
+ clean_up_tokenization_spaces=True) for ids in outputs]
36
+ print(preds_cleaned)
37
+ return preds_cleaned
38
+ ```
config.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "_name_or_path": "./ckpts/data7w/checkpoint-15000",
3
  "architectures": [
4
  "T5ForConditionalGeneration"
5
  ],
 
1
  {
2
+ "_name_or_path": "./ckpts/data8w/checkpoint-30000",
3
  "architectures": [
4
  "T5ForConditionalGeneration"
5
  ],
optimizer.pt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:debd08a8934f406734874ddae41a070fa79392a790d9b0b1bfdfb12483ba1c8f
3
  size 1980801667
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64050a7d3cca2e99eb1cebb9e8dd3b08d7e5635b8057a755ad031132ad1e754b
3
  size 1980801667
pytorch_model.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ea2a63eb3c349409aa5feca6c295484505753788b48d50f06c1d540fa5ba0a6e
3
  size 990413657
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0175df517a4511cb9ca17ad07b5aec9d7bab45832e8073e6eb2c9a51154788b
3
  size 990413657
rng_state.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ec4fa2cce7927ff90e848326a7c5a6caacc85931725c736aebf60a16a8afc209
3
  size 14657
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45112dceaf00de83a4ec5456ff955cba53c32bc4bde209d0a92309921b5d5306
3
  size 14657
scheduler.pt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:124e9dd4835893ac44031b91135b83c01999e98dfe14413d60538837437f6765
3
  size 623
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9e1f7dd49eec2b5c97573622413e8996b9b6e76c7b4dbf86a59c9458d7816ad
3
  size 623
trainer_state.json CHANGED
The diff for this file is too large to render. See raw diff
 
training_args.bin CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5898971c771f6b937939dbb6fdffe250035e6409ba605078700d4c3b33524015
3
- size 3183
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:82eb62b59f4f30a3619a2d4a9b3e311bf2204eedc85619b0b5d9d7f1ba4e2f38
3
+ size 3119