NakJun commited on
Commit
261246d
โ€ข
1 Parent(s): f433152

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +75 -3
README.md CHANGED
@@ -1,3 +1,75 @@
1
- ---
2
- license: llama3.2
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3.2
3
+ datasets:
4
+ - KorQuAD/squad_kor_v1
5
+ language:
6
+ - ko
7
+ base_model:
8
+ - meta-llama/Llama-3.1-8B-Instruct
9
+ ---
10
+
11
+ # Llama-3.2-1B-Instruct-korQuAD-v1
12
+
13
+ ์ด ๋ชจ๋ธ์€ Llama-3.2-1B-Instruct๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ๊ตญ์–ด ์งˆ์˜์‘๋‹ต ํƒœ์Šคํฌ์— ๋Œ€ํ•ด ํŒŒ์ธํŠœ๋‹๋œ ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค.
14
+
15
+ ## ๋ชจ๋ธ ์„ค๋ช…
16
+
17
+ - ๊ธฐ๋ณธ ๋ชจ๋ธ: Llama-3.2-1B-Instruct
18
+ - ํ•™์Šต ๋ฐ์ดํ„ฐ์…‹: KorQuAD v1.0
19
+ - ํ•™์Šต ๋ฐฉ๋ฒ•: LoRA (Low-Rank Adaptation)
20
+ - ์ฃผ์š” ํƒœ์Šคํฌ: ํ•œ๊ตญ์–ด ์งˆ์˜์‘๋‹ต
21
+
22
+ ## ์‚ฌ์šฉ ๋ฐฉ๋ฒ•
23
+
24
+ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ชจ๋ธ์„ ๋กœ๋“œํ•˜๊ณ  ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
25
+ ```
26
+ #๋ชจ๋ธ, ํ† ํฌ๋‚˜์ด์ € ๋กœ๋“œ
27
+ from transformers import AutoModelForCausalLM, AutoTokenizer
28
+ import torch
29
+ model_path = "NakJun/Llama-3.2-1B-Instruct-ko-QuAD"
30
+ model = AutoModelForCausalLM.from_pretrained(
31
+ model_path,
32
+ torch_dtype=torch.bfloat16,
33
+ device_map="auto",
34
+ )
35
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
36
+
37
+ #์ž…๋ ฅ ํ˜•์‹ ์„ค์ •
38
+ prompt = f"""
39
+ ### Question:
40
+ {question}
41
+ ### Context:
42
+ {context}
43
+ ### Answer:
44
+ """
45
+
46
+ #ํ† ํฐํ™” ๋ฐ ์ถ”๋ก 
47
+ input_ids = tokenizer.encode(prompt, return_tensors="pt").to(model.device)
48
+ output = model.generate(
49
+ input_ids,
50
+ max_new_tokens=100,
51
+ temperature=0.1,
52
+ repetition_penalty=1.3,
53
+ do_sample=True,
54
+ eos_token_id=tokenizer.eos_token_id
55
+ )
56
+ generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
57
+ answer = generated_text.split("Answer:")[-1].strip().split('\n')[0].strip()
58
+ print("์ƒ์„ฑ๋œ ๋‹ต๋ณ€:", answer)
59
+
60
+ ```
61
+
62
+ ## ํ•™์Šต ์„ธ๋ถ€ ์ •๋ณด
63
+ - ์—ํญ: 5
64
+ - ๋ฐฐ์น˜ ํฌ๊ธฐ: 1
65
+ - ํ•™์Šต๋ฅ : 2e-4
66
+ - ์˜ตํ‹ฐ๋งˆ์ด์ €: AdamW (32-bit)
67
+ - LoRA ์„ค์ •:
68
+ - r: 16
69
+ - lora_alpha: 16
70
+ - ๋Œ€์ƒ ๋ชจ๋“ˆ: ["q_proj", "v_proj", "k_proj", "o_proj", "gate_proj", "down_proj", "up_proj"]
71
+ - lora_dropout: 0.01
72
+
73
+ ## ์—ฐ๋ฝ์ฒ˜
74
+ - njsung1217@gmail.com
75
+ - https://github.com/nakjun