File size: 5,290 Bytes
5250064
 
bec50eb
 
 
 
 
 
2fde671
5250064
 
 
 
8e7f3ca
 
5250064
b1b90ad
5250064
b1b90ad
5250064
3a5875d
b1b90ad
48ea6ce
5250064
893647a
5250064
893647a
5250064
 
893647a
f70ba28
5250064
893647a
 
 
5250064
fe53f77
43bc030
893647a
 
 
 
 
 
5250064
893647a
5250064
893647a
 
5250064
893647a
 
 
 
 
 
 
 
 
 
 
5250064
893647a
cce37ef
5250064
893647a
 
5250064
893647a
5250064
893647a
5250064
bec50eb
5250064
893647a
5250064
 
 
893647a
5250064
 
 
12983f6
 
 
 
893647a
 
 
 
15b3b58
893647a
12983f6
893647a
12983f6
 
893647a
 
 
 
 
 
12983f6
893647a
12983f6
 
893647a
 
 
 
 
bec50eb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
library_name: transformers
tags:
- llama3
- meta
- facebook
language:
- ko
license: cc-by-nc-4.0
---

# Model Card for Model ID

The **Llama-3-instruction-constructionsafety-layertuning** model is a fine-tuned model based on **beomi/Llama-3-KoEn-8B-Instruct-preview**

<!-- Provide a quick summary of what the model is/does. -->
## Model Details

**Llama-3-instruction-constructionsafety-layertuning**

Llama-3-instruction-constructionsafety-layertuning model is fine-tuned model based on beomi/Llama-3-KoEn-8B-Instruction-preview.

The training was conducted based on the QA datasets and RAW data of Constrution Safety Guidelines provided by the Korea Ocupational Safety and Health Agency(KOSHA).

The training was conducted using full parameter tuning, utilizing 2xA100GPU(80GB). Approximately 11,000 data were used for the training process.

After fine-tuning the entire layers, layers 0, 30, and 31 were replaced with parameters from the base model. This was done as a precautionary measure to prevent errors resulting from training on raw data.


## Simple Use


```
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline

model_name = "DBCM/Llama-3-instruction-constructionsafety-layertuning"
token = "your_access_token"
tuned_model = AutoModelForCausalLM.from_pretrained(
    model_name,
    token=access_token,
    torch_dtype="auto",
    device_map="auto",
)

tokenizer = AutoTokenizer.from_pretrained(model_name, token=access_token)

tokenizer.pad_token = tokenizer.eos_token
pipe = pipeline("text-generation", model=tuned_model, tokenizer = tokenizer, torch_dtype=torch.bfloat16, device_map="auto")

# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
messages = [
    {
        "role": "system",
        "content": "์นœ์ ˆํ•œ ๊ฑด์„ค์•ˆ์ „์ „๋ฌธ๊ฐ€๋กœ์„œ ์ƒ๋Œ€๋ฐฉ์˜ ์š”์ฒญ์— ์ตœ๋Œ€ํ•œ '์ž์„ธํ•˜๊ณ ' ์นœ์ ˆํ•˜๊ฒŒ ๋‹ตํ•˜์ž. ๋ชจ๋“  ๋Œ€๋‹ต์€ ํ•œ๊ตญ์–ด(Korean)์œผ๋กœ ๋Œ€๋‹ตํ•ด์ค˜.",
    },
    {"role": "user", "content": "ํ™๋ง‰์ด ๊ฐ€์‹œ์„ค ๊ณต์‚ฌ์‹œ ์ž‘์—…์ž ์•ˆ์ „์กฐ์น˜์— ๋Œ€ํ•ด์„œ 10๊ฐ€์ง€ ์ •๋„ ์•Œ๋ ค์ฃผ์„ธ์š”."},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipe(prompt, max_new_tokens=1024, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])

```
### Output

```
<|begin_of_text|><|start_header_id|>system<|end_header_id|>

์นœ์ ˆํ•œ ๊ฑด์„ค์•ˆ์ „์ „๋ฌธ๊ฐ€๋กœ์„œ ์ƒ๋Œ€๋ฐฉ์˜ ์š”์ฒญ์— ์ตœ๋Œ€ํ•œ '์ž์„ธํ•˜๊ณ ' ์นœ์ ˆํ•˜๊ฒŒ ๋‹ตํ•˜์ž. ๋ชจ๋“  ๋Œ€๋‹ต์€ ํ•œ๊ตญ์–ด(Korean)์œผ๋กœ ๋Œ€๋‹ตํ•ด์ค˜.<|eot_id|><|start_header_id|>user<|end_header_id|>

ํ™๋ง‰์ด ๊ฐ€์‹œ์„ค ๊ณต์‚ฌ์‹œ ์ž‘์—…์ž ์•ˆ์ „์กฐ์น˜์— ๋Œ€ํ•ด์„œ 10๊ฐ€์ง€ ์ •๋„ ์•Œ๋ ค์ฃผ์„ธ์š”.<|eot_id|><|start_header_id|>assistant<|end_header_id|>

1. ํ™๋ง‰์ด ๊ณต์‚ฌ ์ฐฉ๊ณต ์ „์— ์ง€ํ•˜๋งค์„ค๋ฌผ์˜ ์œ ๋ฌด๋ฅผ ํ™•์ธํ•˜๊ณ  ์ง€ํ•˜๋งค์„ค๋ฌผ์„ ๋ณดํ˜ธํ•˜๊ธฐ ์œ„ํ•œ ์กฐ์น˜๋ฅผ ์ทจํ•˜์—ฌ์•ผ ํ•œ๋‹ค. 2. ํ™๋ง‰์ด ๋ฒฝ์˜ ๋ฐฐ๋ฉด ์ง€๋ฐ˜ ๋†’์ด๊ฐ€ ํ™๋ง‰์ด ๋ฒฝ ๋†’์ด๋ณด๋‹ค ๋‚ฎ์€ ๊ฒฝ์šฐ, ์ง€๋ฐ˜์˜ ๋ถ•๊ดด๋ฅผ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•œ ํ•„์š”ํ•œ ์กฐ์น˜๋ฅผ ์ทจํ•˜์—ฌ์•ผ ํ•œ๋‹ค. 3. ํ™๋ง‰์ด ๋ฒฝ์€ ์ฃผ๋ณ€ ์ง€๋ฐ˜ ๋ฐ ๊ตฌ์กฐ๋ฌผ์˜ ๊ท ์—ด์„ ๋ฐฉ์ง€ํ•˜๊ณ , ์ธ์ ‘ ๊ตฌ์กฐ๋ฌผ์— ์˜ํ–ฅ์„ ๋ฏธ์น˜์ง€ ์•Š๋„๋ก ์„ค์น˜ํ•˜์—ฌ์•ผ ํ•œ๋‹ค. 4. ํ™๋ง‰์ด ๊ณต์‚ฌ ์ค‘ ์ธ์ ‘ ๊ตฌ์กฐ๋ฌผ, ์ œ3์ž์˜ ๊ถŒ๋ฆฌ ๋˜๋Š” ์ด์ต์„ ์นจํ•ดํ•˜์ง€ ์•Š๋„๋ก ์กฐ์น˜๋ฅผ ์ทจํ•˜์—ฌ์•ผ ํ•œ๋‹ค. 5. ํ™๋ง‰์ด ๊ณต์‚ฌ ์ค‘ ์ง€ํ•˜์ˆ˜์œ„์˜ ์ €ํ•˜๋กœ ์ธํ•˜์—ฌ ์ธ์ ‘ํ•œ ๋„๋กœ๋‚˜ ๊ฑด์ถ•๋ฌผ ๋“ฑ์— ์˜ํ–ฅ์„ ๋ฏธ์น  ์šฐ๋ ค๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ, ๊ทธ ์šฐ๋ ค๊ฐ€ ์—†๋„๋ก ์กฐ์น˜๋ฅผ ์ทจํ•˜์—ฌ์•ผ ํ•œ๋‹ค. 6. ํ™๋ง‰์ด ๊ณต์‚ฌ ์‹œ ๋น„์ƒ๊ฒฝ๋ณด์‹œ์„ค์„ ์„ค์น˜ํ•˜์—ฌ ์‘๊ธ‰์ƒํ™ฉ์— ๋Œ€๋น„ํ•˜๊ณ , ์•ˆ์ „๊ต์œก์„ ์‹ค์‹œํ•˜์—ฌ์•ผ ํ•œ๋‹ค. 7. ํ™๋ง‰์ด ๊ณต์‚ฌ ์ค‘ ๊ด€๊ณ„๊ธฐ๊ด€์˜ ์š”๊ตฌ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ, ๊ทธ ์š”๊ตฌ์— ๋”ฐ๋ผ ์กฐ์น˜๋ฅผ ์ทจํ•˜์—ฌ์•ผ ํ•œ๋‹ค. 8. ํ™๋ง‰์ด ๊ณต์‚ฌ ์ค‘ ํ™๋ง‰์ด ๋ฒฝ์˜ ๊ธฐ์šธ๊ธฐ๋ฅผ 1/50 ์ด์ƒ 1/30 ์ดํ•˜๋กœ ์œ ์ง€ํ•˜๊ณ , ์ˆ˜ํ‰์œผ๋กœ ์„ค์น˜ํ•˜๋Š” ํ™๋ง‰์ด์˜ ๊ฒฝ์šฐ์—๋Š” ์ง€๋ฐ˜์ด ์ˆ˜ํ‰์œผ๋กœ ์œ ์ง€๋˜๋„๋ก ํ•˜์—ฌ์•ผ ํ•œ๋‹ค. 9. ํ™๋ง‰์ด ๊ณต์‚ฌ ์ค‘ ํ™๋ง‰์ด ๋ฒฝ์— ์ž‘์šฉํ•˜๋Š” ํ† ์••์ด ์„ค๊ณ„๊ธฐ์ค€์„ ์ดˆ๊ณผํ•˜์ง€ ์•Š๋„๋ก ํ•˜์—ฌ์•ผ ํ•œ๋‹ค. 10. ํ™๋ง‰์ด ๊ณต์‚ฌ ์ค‘ ํ™๋ง‰์ด ๋ฒฝ์˜ ๋ฌด๋„ˆ์ง์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ์ง€๋ฐ˜์ด ์ˆ˜ํ‰์œผ๋กœ ์œ ์ง€๋˜๋„๋ก ํ•˜์—ฌ์•ผ ํ•œ๋‹ค.

```


### Training Data
Training Data will be provided upon requests.
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->


## Citation instructions

**Llama-3-instruction-constructionsafety-layertuning**
```
@article{llama3cs-layertuning,
  title={Llama-3-instruction-constructionsafety-layertuning},
  author={L, Jungwon, A, Seungjun},
  year={2024},
  url={https://huggingface.co/DBCM/Llama-3-instruction-constructionsafety-layertuning}
}
```

**Llama-3-Open-Ko**
```
@article{llama3koen,
  title={Llama-3-KoEn},
  author={L, Junbum},
  year={2024},
  url={https://huggingface.co/beomi/Llama-3-KoEn-8B}
}
```

**Original Llama-3**
```
@article{llama3modelcard,
  title={Llama 3 Model Card},
  author={AI@Meta},
  year={2024},
  url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md}
```