File size: 1,235 Bytes
a085f5c 5877e1d 89a7c8c 5877e1d 20a8a0e 5877e1d |
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 |
---
license: apache-2.0
---
llama-3-Korean-Bllossom-8B๋ฅผ Foundation์ผ๋ก KorQuad Chat Full Fine Tuning Version ์
๋๋ค.
*Python Code
import transformers
import torch
model_id = "SEOKDONG/llama-3-Korean-Bllossom-8B-sft"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
pipeline.model.eval()
PROMPT = '''You are a helpful AI assistant. Please answer the user's questions kindly. ๋น์ ์ ์ ๋ฅํ AI ์ด์์คํดํธ ์
๋๋ค. ์ฌ์ฉ์์ ์ง๋ฌธ์ ๋ํด ์น์ ํ๊ฒ ๋ต๋ณํด์ฃผ์ธ์.'''
instruction = "์์ธ์ ์ ๋ช
ํ ๊ด๊ด ์ฝ์ค๋ฅผ ๋ง๋ค์ด์ค๋?"
messages = [
{"role": "system", "content": f"{PROMPT}"},
{"role": "user", "content": f"{instruction}"}
]
prompt = pipeline.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
terminators = [
pipeline.tokenizer.eos_token_id,
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipeline(
prompt,
max_new_tokens=2048,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=0.9
)
print(outputs[0]["generated_text"][len(prompt):]) |