Views
No views yet
meta-llama/Meta-Llama-3.1-8B-Instructunsloth/Meta-Llama-3.1-8B-Instruct model1# 자세한 사항은 demo-Llama3.1.ipynb 확인
2from unsloth import FastLanguageModel
3from unsloth.chat_templates import get_chat_template
4from IPython.display import display, Markdown
5
6model, tokenizer = FastLanguageModel.from_pretrained(
7 model_name = "LimYeri/CodeMind-Llama3.1-8B-unsloth", # YOUR MODEL YOU USED FOR TRAINING
8 max_seq_length = max_seq_length,
9 dtype = dtype,
10 load_in_4bit = load_in_4bit,
11)
12
13tokenizer = get_chat_template(
14 tokenizer,
15 chat_template = "llama-3.1",
16)
17FastLanguageModel.for_inference(model) # Enable native 2x faster inference
18
19messages = [
20 {"role": "system", "content": "You are a kind coding test teacher."},
21 {"role": "user", "content": "Enter your coding problem or question here."},
22]
23inputs = tokenizer.apply_chat_template(
24 messages,
25 tokenize = True,
26 add_generation_prompt = True, # Must add for generation
27 return_tensors = "pt",
28).to("cuda")
29
30outputs = model.generate(input_ids = inputs, max_new_tokens = 3000, use_cache = True,
31 temperature = 0.5, min_p = 0.3) # Feel free to adjust the temperature and min_p
32text = (tokenizer.batch_decode(outputs))[0].split('assistant<|end_header_id|>\n\n')[1].strip()
33display(Markdown(text))is_bfloat16_supported()is_bfloat16_supported()| Metric | Value |
|---|---|
| Average | 22.17 |
| IFEval | 64.9 |
| BBH | 24.19 |
| MATH Lvl 5 | 9.97 |
| GPQA | 1.9 |
| MUSR | 6.04 |
| MMLU-PRO | 26 |