technicalhub
commited on
Commit
β’
f8525ef
1
Parent(s):
ffc1c10
Upload 4 files
Browse files- README.md +43 -0
- config.json +51 -0
- pytorch_model.bin +3 -0
- tokenizer.json +0 -0
README.md
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-nc-sa-4.0
|
3 |
+
datasets:
|
4 |
+
- nlpai-lab/kullm-v2
|
5 |
+
language:
|
6 |
+
- ko
|
7 |
+
pipeline_tag: text-generation
|
8 |
+
---
|
9 |
+
|
10 |
+
κ΅μ‘μ©μΌλ‘ νμ΅ ν κ°λ¨ν instruction fine-tuning λͺ¨λΈ (updated 2023/08/06)
|
11 |
+
|
12 |
+
- Pretrained model: skt/kogpt2-base-v2 (https://github.com/SKT-AI/KoGPT2)
|
13 |
+
- Training data: kullm-v2(https://huggingface.co/datasets/nlpai-lab/kullm-v2)
|
14 |
+
|
15 |
+
```python
|
16 |
+
from transformers import AutoModelForCausalLM
|
17 |
+
from transformers import PreTrainedTokenizerFast
|
18 |
+
|
19 |
+
tokenizer = PreTrainedTokenizerFast.from_pretrained("hyunjae/skt-kogpt2-kullm-v2",
|
20 |
+
bos_token='</s>', eos_token='</s>', unk_token='<unk>',
|
21 |
+
pad_token='<pad>', mask_token='<mask>', padding_side="right", model_max_length=512)
|
22 |
+
model = AutoModelForCausalLM.from_pretrained('hyunjae/skt-kogpt2-kullm-v2').to('cuda')
|
23 |
+
|
24 |
+
PROMPT= "### system:μ¬μ©μμ μ§λ¬Έμ λ§λ μ μ ν μλ΅μ μμ±νμΈμ.\n### μ¬μ©μ:{instruction}\n### μλ΅:"
|
25 |
+
text = PROMPT.format_map({'instruction':"μλ
? λκ° ν μ μλκ² λμΌ?"})
|
26 |
+
input_ids = tokenizer.encode(text, return_tensors='pt').to(model.device)
|
27 |
+
|
28 |
+
gen_ids = model.generate(input_ids,
|
29 |
+
repetition_penalty=2.0,
|
30 |
+
pad_token_id=tokenizer.pad_token_id,
|
31 |
+
eos_token_id=tokenizer.eos_token_id,
|
32 |
+
bos_token_id=tokenizer.bos_token_id,
|
33 |
+
num_beams=4,
|
34 |
+
no_repeat_ngram_size=4,
|
35 |
+
max_new_tokens=128,
|
36 |
+
do_sample=True,
|
37 |
+
top_k=50)
|
38 |
+
|
39 |
+
|
40 |
+
generated = tokenizer.decode(gen_ids[0])
|
41 |
+
print(generated)
|
42 |
+
|
43 |
+
```
|
config.json
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "skt/kogpt2-base-v2",
|
3 |
+
"_num_labels": 1,
|
4 |
+
"activation_function": "gelu_new",
|
5 |
+
"architectures": [
|
6 |
+
"GPT2LMHeadModel"
|
7 |
+
],
|
8 |
+
"attn_pdrop": 0.1,
|
9 |
+
"author": "Heewon Jeon([email protected])",
|
10 |
+
"bos_token_id": 0,
|
11 |
+
"created_date": "2021-04-28",
|
12 |
+
"embd_pdrop": 0.1,
|
13 |
+
"eos_token_id": 1,
|
14 |
+
"gradient_checkpointing": false,
|
15 |
+
"id2label": {
|
16 |
+
"0": "LABEL_0"
|
17 |
+
},
|
18 |
+
"initializer_range": 0.02,
|
19 |
+
"label2id": {
|
20 |
+
"LABEL_0": 0
|
21 |
+
},
|
22 |
+
"layer_norm_epsilon": 1e-05,
|
23 |
+
"license": "CC-BY-NC-SA 4.0",
|
24 |
+
"model_type": "gpt2",
|
25 |
+
"n_ctx": 1024,
|
26 |
+
"n_embd": 768,
|
27 |
+
"n_head": 12,
|
28 |
+
"n_inner": null,
|
29 |
+
"n_layer": 12,
|
30 |
+
"n_positions": 1024,
|
31 |
+
"pad_token_id": 3,
|
32 |
+
"reorder_and_upcast_attn": false,
|
33 |
+
"resid_pdrop": 0.1,
|
34 |
+
"scale_attn_by_inverse_layer_idx": false,
|
35 |
+
"scale_attn_weights": true,
|
36 |
+
"summary_activation": null,
|
37 |
+
"summary_first_dropout": 0.1,
|
38 |
+
"summary_proj_to_labels": true,
|
39 |
+
"summary_type": "cls_index",
|
40 |
+
"summary_use_proj": true,
|
41 |
+
"task_specific_params": {
|
42 |
+
"text-generation": {
|
43 |
+
"do_sample": true,
|
44 |
+
"max_length": 50
|
45 |
+
}
|
46 |
+
},
|
47 |
+
"torch_dtype": "float32",
|
48 |
+
"transformers_version": "4.31.0",
|
49 |
+
"use_cache": true,
|
50 |
+
"vocab_size": 51200
|
51 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1f96532ab2bee50085f6c06923f4ea3ac8d184b9efe67bf25a7088617d5f6f15
|
3 |
+
size 500704093
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|