Ubuntu commited on
Commit
1ce9016
1 Parent(s): c1e1184

initial commit

Browse files
Files changed (5) hide show
  1. README.md +46 -0
  2. config.json +48 -0
  3. pytorch_model.bin +3 -0
  4. summ.png +0 -0
  5. tokenizer.json +0 -0
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: ko
3
+ tags:
4
+ - bart
5
+ license: MIT
6
+ ---
7
+
8
+ # Korean News Summarization Model
9
+
10
+ ## How to use
11
+
12
+ ```python
13
+ from transformers import PreTrainedTokenizerFast
14
+ from transformers import BartForConditionalGeneration
15
+
16
+ tokenizer = PreTrainedTokenizerFast(
17
+ 'gogamza/kobart-summarization',
18
+ bos_token='<s>', eos_token='</s>', unk_token='<unk>', pad_token='<pad>', mask_token='<mask>')
19
+
20
+ model = BartForConditionalGeneration.from_pretrained('gogamza/kobart-summarization')
21
+
22
+ text = "과거를 떠올려보자. 방송을 보던 우리의 모습을..."
23
+
24
+ raw_input_ids = tokenizer.encode(text)
25
+ input_ids = [tokenizer.bos_token_id] + \
26
+ raw_input_ids + [tokenizer.eos_token_id]
27
+ summary_ids = model.generate(torch.tensor([input_ids]),
28
+ max_length=150,
29
+ early_stopping=False,
30
+ num_beams=5,
31
+ repetition_penalty=1.0,
32
+ eos_token_id=tokenizer.eos_token_id)
33
+ summ_text = tokenizer.batch_decode(summary_ids.tolist(), skip_special_tokens=True)[0]
34
+ ```
35
+
36
+ ## Demo
37
+
38
+ - <a href="http://52.231.69.211:8081/" target="_blank">요약 데모</a>
39
+
40
+ <table><tr><td>
41
+ <center><img src="summ.png" width="600"/></center>
42
+ </td></tr></table>
43
+
44
+
45
+
46
+
config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_dropout": 0.0,
3
+ "activation_function": "gelu",
4
+ "add_bias_logits": false,
5
+ "add_final_layer_norm": false,
6
+ "architectures": [
7
+ "BartForConditionalGeneration"
8
+ ],
9
+ "attention_dropout": 0.0,
10
+ "bos_token_id": 0,
11
+ "classif_dropout": 0.1,
12
+ "classifier_dropout": 0.1,
13
+ "d_model": 768,
14
+ "decoder_attention_heads": 16,
15
+ "decoder_ffn_dim": 3072,
16
+ "decoder_layerdrop": 0.0,
17
+ "decoder_layers": 6,
18
+ "do_blenderbot_90_layernorm": false,
19
+ "dropout": 0.1,
20
+ "encoder_attention_heads": 16,
21
+ "encoder_ffn_dim": 3072,
22
+ "encoder_layerdrop": 0.0,
23
+ "encoder_layers": 6,
24
+ "eos_token_id": 1,
25
+ "extra_pos_embeddings": 2,
26
+ "force_bos_token_to_be_generated": false,
27
+ "id2label": {
28
+ "0": "NEGATIVE",
29
+ "1": "POSITIVE"
30
+ },
31
+ "init_std": 0.02,
32
+ "is_encoder_decoder": true,
33
+ "label2id": {
34
+ "NEGATIVE": 0,
35
+ "POSITIVE": 1
36
+ },
37
+ "max_position_embeddings": 1026,
38
+ "model_type": "bart",
39
+ "normalize_before": false,
40
+ "normalize_embedding": true,
41
+ "num_hidden_layers": 6,
42
+ "pad_token_id": 3,
43
+ "scale_embedding": false,
44
+ "static_position_embeddings": false,
45
+ "use_cache": true,
46
+ "vocab_size": 30000,
47
+ "author": "Heewon Jeon(madjakarta@gmail.com)"
48
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f59dd27e0e73b4b5cf45a6c70513cc5af667df248be097874be71bc51fd5f53
3
+ size 495659091
summ.png ADDED
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff