Edit model card

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

Model Details

Llama-3-instruction-constructionsafety-layertuning

Llama-3-instruction-constructionsafety-layertuning model is contined pretrained 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.

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}
Downloads last month
1,400
Safetensors
Model size
8.03B params
Tensor type
BF16
ยท