byeongal commited on
Commit
a5c1aa0
β€’
1 Parent(s): 22d5045

ko-dialogpt-test-version

Browse files
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: ko
3
+ tags:
4
+ - gpt2
5
+ - conversational
6
+ license: cc-by-nc-sa 4.0
7
+ ---
8
+ ## Ko-DialoGPT
9
+
10
+
11
+ ### How to use
12
+ ```python
13
+ from transformers import AutoModelForCausalLM, AutoTokenizer
14
+ import torch
15
+
16
+ tokenizer = AutoTokenizer.from_pretrained("microsoft/DialoGPT-small")
17
+ model = AutoModelForCausalLM.from_pretrained("microsoft/DialoGPT-small")
18
+
19
+ for step in range(5):
20
+ # encode the new user input, add the eos_token and return a tensor in Pytorch
21
+ new_user_input_ids = tokenizer.encode(input(">> User:") + tokenizer.eos_token, return_tensors='pt')
22
+ # append the new user input tokens to the chat history
23
+ bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step > 0 else new_user_input_ids
24
+ # generated a response while limiting the total chat history to 1000 tokens,
25
+ chat_history_ids = model.generate(bot_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id)
26
+ # pretty print last ouput tokens from bot
27
+ print("BOT: {}".format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)))
28
+ ```
29
+
30
+ ### Reference
31
+ * [SKT-KoGPT2](https://huggingface.co/skt/kogpt2-base-v2)
32
+ * [KETI R&D 데이터](https://aihub.or.kr/opendata/keti-data/recognition-laguage/KETI-02-008)
33
+ * [ν•œκ΅­μ–΄ λŒ€ν™” μš”μ•½](https://aihub.or.kr/aidata/30714)
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_function": "gelu_new",
3
+ "architectures": [
4
+ "GPT2LMHeadModel"
5
+ ],
6
+ "attn_pdrop": 0.1,
7
+ "author": "Heewon Jeon(madjakarta@gmail.com)",
8
+ "bos_token_id": 0,
9
+ "created_date": "2021-04-28",
10
+ "embd_pdrop": 0.1,
11
+ "eos_token_id": 1,
12
+ "gradient_checkpointing": false,
13
+ "initializer_range": 0.02,
14
+ "layer_norm_epsilon": 1e-05,
15
+ "license": "CC-BY-NC-SA 4.0",
16
+ "model_type": "gpt2",
17
+ "n_ctx": 1024,
18
+ "n_embd": 768,
19
+ "n_head": 12,
20
+ "n_inner": null,
21
+ "n_layer": 12,
22
+ "n_positions": 1024,
23
+ "pad_token_id": 3,
24
+ "resid_pdrop": 0.1,
25
+ "scale_attn_weights": true,
26
+ "summary_activation": null,
27
+ "summary_first_dropout": 0.1,
28
+ "summary_proj_to_labels": true,
29
+ "summary_type": "cls_index",
30
+ "summary_use_proj": true,
31
+ "task_specific_params": {
32
+ "conversational": {
33
+ "max_length": 1000
34
+ }
35
+ },
36
+ "transformers_version": "4.8.1",
37
+ "use_cache": true,
38
+ "vocab_size": 51200
39
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42e11fe9d1a801b2d192e27950a43f8e6b12a5f7a389d682a64bc2804087a8f5
3
+ size 513305211
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
1
+ {"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>", "mask_token": "<mask>"}
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
1
+ {"special_tokens_map_file": "../base_model/kogpt2-base-v2/special_tokens_map.json", "name_or_path": "ko-dialogpt-λŒ€ν™”μš”μ•½", "tokenizer_class": "PreTrainedTokenizerFast"}