PathFinderKR's picture
Update README.md
e6fbc1d verified
|
raw
history blame
10.5 kB
metadata
language:
  - ko
  - en
license: llama3
library_name: transformers
datasets:
  - MarkrAI/KoCommercial-Dataset
tags:
  - llama
  - llama-3

Waktaverse-Llama-3-KO-8B-Instruct Model Card

Model Details

image/webp Waktaverse-Llama-3-KO-8B-Instruct is a state-of-the-art Korean language model developed by Waktaverse AI team. This large language model is a specialized version of the Meta-Llama-3-8B-Instruct, tailored for Korean natural language processing tasks. It is designed to handle a variety of complex instructions and generate coherent, contextually appropriate responses.

Model Sources

  • Repository: GitHub
  • Paper : [More Information Needed]

Uses

Direct Use

The model can be utilized directly for tasks such as text completion, summarization, and question answering without any fine-tuning.

Out-of-Scope Use

This model is not intended for use in scenarios that involve high-stakes decision-making including medical, legal, or safety-critical areas due to the potential risks of relying on automated decision-making. Moreover, any attempt to deploy the model in a manner that infringes upon privacy rights or facilitates biased decision-making is strongly discouraged.

Bias, Risks, and Limitations

While Waktaverse Llama 3 is a robust model, it shares common limitations associated with machine learning models including potential biases in training data, vulnerability to adversarial attacks, and unpredictable behavior under edge cases. There is also a risk of cultural and contextual misunderstanding, particularly when the model is applied to languages and contexts it was not specifically trained on.

How to Get Started with the Model

You can run conversational inference using the Transformers Auto classes. We highly recommend that you add Korean system prompt for better output. Adjust the hyperparameters as you need.

Example Usage

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

device = (
    "cuda:0" if torch.cuda.is_available() else # Nvidia GPU
    "mps" if torch.backends.mps.is_available() else # Apple Silicon GPU
    "cpu"
)

model_id = "PathFinderKR/Waktaverse-Llama-3-KO-8B-Instruct"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map=device,
)

################################################################################
# Generation parameters
################################################################################
num_return_sequences=1
max_new_tokens=1024
temperature=0.9
top_k=0 # not recommended
top_p=0.9
repetition_penalty=1.1

def generate_response(system ,user):
    messages = [
        {"role": "system", "content": system},
        {"role": "user", "content": user}
    ]
    prompt = tokenizer.apply_chat_template(
        messages,
        tokenize=False,
        add_generation_prompt=False
    )
    
    input_ids = tokenizer.encode(
        prompt,
        add_special_tokens=False,
        return_tensors="pt"
    ).to(device)
    
    outputs = model.generate(
        input_ids=input_ids,
        pad_token_id=tokenizer.eos_token_id,
        num_return_sequences=num_return_sequences,
        max_new_tokens=max_new_tokens,
        do_sample=True,
        temperature=temperature,
        top_k=top_k,
        top_p=top_p,
        repetition_penalty=repetition_penalty
    )
    
    return tokenizer.decode(outputs[0], skip_special_tokens=False)

system_prompt = "λ‹€μŒ μ§€μ‹œμ‚¬ν•­μ— λŒ€ν•œ 응닡을 μž‘μ„±ν•΄μ£Όμ„Έμš”."
user_prompt = "ν”Όλ³΄λ‚˜μΉ˜ μˆ˜μ—΄μ— λŒ€ν•΄ μ„€λͺ…ν•΄μ£Όμ„Έμš”."
response = generate_response(system_prompt, user_prompt)
print(response)

Example Output

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

λ‹€μŒ μ§€μ‹œμ‚¬ν•­μ— λŒ€ν•œ 응닡을 μž‘μ„±ν•΄μ£Όμ„Έμš”.<|eot_id|><|start_header_id|>user<|end_header_id|>

ν”Όλ³΄λ‚˜μΉ˜ μˆ˜μ—΄μ— λŒ€ν•΄ μ„€λͺ…ν•΄μ£Όμ„Έμš”.<|eot_id|><|start_header_id|>assistant<|end_header_id|>

ν”Όλ³΄λ‚˜μΉ˜ μˆ˜μ—΄μ€ μˆ˜ν•™μ—μ„œ κ°€μž₯ 유λͺ…ν•œ μˆ˜μ—΄ 쀑 ν•˜λ‚˜λ‘œ, 0κ³Ό 1둜 μ‹œμž‘ν•˜λŠ” μˆ«μžλ“€μ˜ λͺ¨μž„μž…λ‹ˆλ‹€. 각 μˆ«μžλŠ” 이전 두 개의 숫자의 ν•©μœΌλ‘œ μ •μ˜λ˜λ©°, μ΄λ ‡κ²Œ 계속 λ°˜λ³΅λ©λ‹ˆλ‹€. ν”Όλ³΄λ‚˜μΉ˜ μˆ˜μ—΄μ€ λ¬΄ν•œνžˆ μ»€μ§€λŠ”λ°, 첫 λ²ˆμ§Έμ™€ 두 번째 항이 λͺ¨λ‘ 0일 μˆ˜λ„ μžˆμ§€λ§Œ μΌλ°˜μ μœΌλ‘œλŠ” 첫 번째 항이 1이고 두 번째 항이 1μž…λ‹ˆλ‹€.

예λ₯Ό λ“€μ–΄, 0 + 1 = 1, 1 + 1 = 2, 2 + 1 = 3, 3 + 2 = 5, 5 + 3 = 8, 8 + 5 = 13, 13 + 8 = 21, 21 + 13 = 34 등이 μžˆμŠ΅λ‹ˆλ‹€. 이 μˆ«μžλ“€μ„ ν”Όλ³΄λ‚˜μΉ˜ μˆ˜μ—΄μ΄λΌκ³  ν•©λ‹ˆλ‹€.

ν”Όλ³΄λ‚˜μΉ˜ μˆ˜μ—΄μ€ λ‹€λ₯Έ μˆ˜μ—΄λ“€κ³Ό ν•¨κ»˜ μ‚¬μš©λ  λ•Œ 도움이 λ©λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄, 금육 μ‹œμž₯μ—μ„œλŠ” 금리 수읡λ₯ μ„ λ‚˜νƒ€λ‚΄κΈ° μœ„ν•΄ 이 μˆ˜μ—΄μ΄ μ‚¬μš©λ©λ‹ˆλ‹€. λ˜ν•œ 컴퓨터 κ³Όν•™κ³Ό 컴퓨터 κ³Όν•™μ—μ„œλ„ μ’…μ’… 찾을 수 μžˆμŠ΅λ‹ˆλ‹€. ν”Όλ³΄λ‚˜μΉ˜ μˆ˜μ—΄μ€ 맀우 λ³΅μž‘ν•˜λ©° λ§Žμ€ μˆ«μžκ°€ λ‚˜μ˜€λ―€λ‘œ 일반적인 μˆ˜μ—΄μ²˜λŸΌ μ‰½κ²Œ ꡬ할 수 μ—†μŠ΅λ‹ˆλ‹€. 이 λ•Œλ¬Έμ— ν”Όλ³΄λ‚˜μΉ˜ μˆ˜μ—΄μ€ λŒ€μˆ˜μ  ν•¨μˆ˜μ™€ 관련이 있으며 μˆ˜ν•™μžλ“€μ€ 이λ₯Ό μ—°κ΅¬ν•˜κ³  κ³„μ‚°ν•˜κΈ° μœ„ν•΄ λ‹€μ–‘ν•œ μ•Œκ³ λ¦¬μ¦˜μ„ κ°œλ°œν–ˆμŠ΅λ‹ˆλ‹€.

참고 자료: https://en.wikipedia.org/wiki/Fibonacci_sequence#Properties.<|eot_id|>

Training Details

Training Data

The model is trained on the MarkrAI/KoCommercial-Dataset, which consists of various commercial texts in Korean.

Training Procedure

The model training used LoRA for computational efficiency. 0.02 billion parameters(0.26% of total parameters) were trained.

Training Hyperparameters

################################################################################
# bitsandbytes parameters
################################################################################
load_in_4bit=True
bnb_4bit_compute_dtype=torch_dtype
bnb_4bit_quant_type="nf4"
bnb_4bit_use_double_quant=False

################################################################################
# LoRA parameters
################################################################################
task_type="CAUSAL_LM"
target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]
r=8
lora_alpha=16
lora_dropout=0.05
bias="none"

################################################################################
# TrainingArguments parameters
################################################################################
num_train_epochs=1
per_device_train_batch_size=1
gradient_accumulation_steps=4
gradient_checkpointing=True
learning_rate=2e-5
lr_scheduler_type="cosine"
warmup_ratio=0.1
optim = "adamw_torch"
weight_decay=0.01

################################################################################
# SFT parameters
################################################################################
max_seq_length=1024
packing=True

Evaluation

Metrics

English

  • AI2 Reasoning Challenge (25-shot): a set of grade-school science questions.
  • HellaSwag (10-shot): a test of commonsense inference, which is easy for humans (~95%) but challenging for SOTA models.
  • MMLU (5-shot): a test to measure a text model's multitask accuracy. The test covers 57 tasks including elementary mathematics, US history, computer science, law, and more.
  • TruthfulQA (0-shot): a test to measure a model's propensity to reproduce falsehoods commonly found online. Note: TruthfulQA is technically a 6-shot task in the Harness because each example is prepended with 6 Q/A pairs, even in the 0-shot setting.
  • Winogrande (5-shot): an adversarial and difficult Winograd benchmark at scale, for commonsense reasoning.
  • GSM8k (5-shot): diverse grade school math word problems to measure a model's ability to solve multi-step mathematical reasoning problems.

Korean

  • Ko-HellaSwag:
  • Ko-MMLU:
  • Ko-Arc:
  • Ko-Truthful QA:
  • Ko-CommonGen V2:

Results

English

Benchmark Waktaverse Llama 3 8B Llama 3 8B
Average 66.77 66.87
ARC 60.32 60.75
HellaSwag 78.55 78.55
MMLU 67.9 67.07
Winograde 74.27 74.51
GSM8K 70.36 68.69

Korean

Benchmark Waktaverse Llama 3 8B Llama 3 8B
Ko-HellaSwag: 0 0
Ko-MMLU: 0 0
Ko-Arc: 0 0
Ko-Truthful QA: 0 0
Ko-CommonGen V2: 0 0

Technical Specifications

Compute Infrastructure

Hardware

  • GPU: NVIDIA GeForce RTX 4080 SUPER

Software

  • Operating System: Linux
  • Deep Learning Framework: Hugging Face Transformers, PyTorch

Training Details

  • Training time: 32 hours
  • VRAM usage: 12.8 GB
  • GPU power usage: 300 W

Citation

Waktaverse-Llama-3

TBD

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

Model Card Authors

[More Information Needed]

Model Card Contact

[More Information Needed]