Views
No views yet
1# pip install accelerate
2from transformers import AutoTokenizer, AutoModelForCausalLM
3import torch
4
5tokenizer = AutoTokenizer.from_pretrained("MDDDDR/Meta-Llama-3.1-8B-it-v0.1")
6model = AutoModelForCausalLM.from_pretrained(
7 "MDDDDR/Meta-Llama-3.1-8B-it-v0.1",
8 device_map="auto",
9 torch_dtype=torch.bfloat16
10)
11
12input_text = "사과가 뭐야?"
13input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
14
15outputs = model.generate(**input_ids)
16print(tokenizer.decode(outputs[0]))1bnd_config = BitsAndBytesConfig(
2 load_in_4bit = True,
3 bnb_4bit_use_double_quant = True,
4 bnb_4bit_quant_type = 'nf4',
5 bnb_4bit_compute_dtype = torch.bfloat16
6)
7
8lora_config = LoraConfig(
9 r = 8,
10 lora_alpha = 8,
11 lora_dropout = 0.05,
12 target_modules = ['gate_proj', 'up_proj', 'down_proj']
13)| Tasks | Version | Filter | n-shot | Metric | Value | Stderr | ||
|---|---|---|---|---|---|---|---|---|
| kobest_boolq | 1 | none | 0 | acc | ↑ | 0.5150 | ± | 0.0133 |
| none | 0 | f1 | ↑ | 0.3634 | ± | N/A | ||
| kobest_copa | 1 | none | 0 | acc | ↑ | 0.6280 | ± | 0.0153 |
| none | 0 | f1 | ↑ | 0.6279 | ± | N/A | ||
| kobest_hellaswag | 1 | none | 0 | acc | ↑ | 0.4280 | ± | 0.0221 |
| none | 0 | acc_norm | ↑ | 0.5540 | ± | 0.0223 | ||
| none | 0 | f1 | ↑ | 0.4250 | ± | N/A | ||
| kobest_sentineg | 1 | none | 0 | acc | ↑ | 0.7406 | ± | 0.0220 |
| none | 0 | f1 | ↑ | 0.7317 | ± | N/A |