|
--- |
|
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} |
|
``` |