File size: 4,018 Bytes
261246d
 
 
d861a43
261246d
d927539
d861a43
 
261246d
 
 
 
 
 
 
 
 
 
 
 
 
fb663ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261246d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c4fb95b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261246d
 
fb663ef
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
language:
- ko
license: llama3.2
base_model:
- meta-llama/Llama-3.2-1B-Instruct
datasets:
- KorQuAD/squad_kor_v1
---

# Llama-3.2-1B-Instruct-korQuAD-v1

이 λͺ¨λΈμ€ Llama-3.2-1B-Instructλ₯Ό 기반으둜 ν•œκ΅­μ–΄ μ§ˆμ˜μ‘λ‹΅ νƒœμŠ€ν¬μ— λŒ€ν•΄ νŒŒμΈνŠœλ‹λœ λͺ¨λΈμž…λ‹ˆλ‹€.

## λͺ¨λΈ μ„€λͺ…

- κΈ°λ³Έ λͺ¨λΈ: Llama-3.2-1B-Instruct
- ν•™μŠ΅ 데이터셋: KorQuAD v1.0
- ν•™μŠ΅ 방법: LoRA (Low-Rank Adaptation)
- μ£Όμš” νƒœμŠ€ν¬: ν•œκ΅­μ–΄ μ§ˆμ˜μ‘λ‹΅

## 버전 νžˆμŠ€ν† λ¦¬
### v1.0.0(2024-10-02)
- 초기 버전 μ—…λ‘œλ“œ
- KorQuAD v1.0 데이터셋 νŒŒμΈνŠœλ‹

### v1.1.0(2024-10-30)
- λͺ¨λΈ ν”„λ‘¬ν”„νŠΈ 및 ν•™μŠ΅ 방법 κ°œμ„ 
- KorQuAD evaluate μ½”λ“œ 적용

## μ„±λŠ₯
| λͺ¨λΈ | Exact Match | F1 Score |
|------|-------------|----------|
| Llama-3.2-1B-Instruct-v1 | 18.86 | 37.2 |
| Llama-3.2-1B-Instruct-v2 | 36.07 | 59.03 |
β€» https://korquad.github.io/category/1.0_KOR.html의 evaluation script μ‚¬μš©

## μ‚¬μš© 방법

λ‹€μŒκ³Ό 같이 λͺ¨λΈμ„ λ‘œλ“œν•˜κ³  μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€:
```
#λͺ¨λΈ, ν† ν¬λ‚˜μ΄μ € λ‘œλ“œ
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_path = "NakJun/Llama-3.2-1B-Instruct-ko-QuAD"
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.bfloat16,
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(model_path)

#μž…λ ₯ ν˜•μ‹ μ„€μ •
prompt = f"""
### Question:
{question}
### Context:
{context}
### Answer:
"""

#토큰화 및 μΆ”λ‘ 
input_ids = tokenizer.encode(prompt, return_tensors="pt").to(model.device)
output = model.generate(
input_ids,
max_new_tokens=100,
temperature=0.1,
repetition_penalty=1.3,
do_sample=True,
eos_token_id=tokenizer.eos_token_id
)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
answer = generated_text.split("Answer:")[-1].strip().split('\n')[0].strip()
print("μƒμ„±λœ λ‹΅λ³€:", answer)

```

## ν•™μŠ΅ μ„ΈλΆ€ 정보
- 에폭: 5
- 배치 크기: 1
- ν•™μŠ΅λ₯ : 2e-4
- μ˜΅ν‹°λ§ˆμ΄μ €: AdamW (32-bit)
- LoRA μ„€μ •:
  - r: 16
  - lora_alpha: 16
  - λŒ€μƒ λͺ¨λ“ˆ: ["q_proj", "v_proj", "k_proj", "o_proj", "gate_proj", "down_proj", "up_proj"]
  - lora_dropout: 0.01

## μ˜ˆμ‹œ 질문 및 λ‹΅λ³€
```
[μ˜ˆμ‹œ 1: 순천ν–₯λŒ€ν•™κ΅]

Context:
순천ν–₯λŒ€ν•™κ΅λŠ” 좩청남도 μ•„μ‚°μ‹œ μ‹ μ°½λ©΄ 순천ν–₯λ‘œμ— μœ„μΉ˜ν•œ 사립 μ’…ν•©λŒ€ν•™κ΅μž…λ‹ˆλ‹€.
순천ν–₯λŒ€ν•™κ΅μ—λŠ” 1983λ…„ κ³΅κ³ΌλŒ€ν•™μ΄ μ„€λ¦½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

Question: 순천ν–₯λŒ€ν•™κ΅μ˜ μœ„μΉ˜λŠ”?
Answer: 좩청남도 μ•„μ‚°μ‹œ μ‹ μ°½λ©΄ 순천ν–₯둜

[μ˜ˆμ‹œ 2: μ•„μ΄λΈŒ(IVE)]

Context:
μ•„μ΄λΈŒ(IVE)λŠ” λŒ€ν•œλ―Όκ΅­μ˜ μŠ€νƒ€μ‰½ μ—”ν„°ν…ŒμΈλ¨ΌνŠΈ μ†Œμ†μ˜ 6인쑰 걸그룹으둜, 2021λ…„ 12μ›” 1일에 λ°λ·”ν–ˆμŠ΅λ‹ˆλ‹€.
κ·Έλ£Ή 이름인 'IVE'λŠ” "I HAVE"μ—μ„œ μœ λž˜ν–ˆμœΌλ©°, "λ‚΄κ°€ 가진 것을 λ‹Ήλ‹Ήν•˜κ²Œ 보여주겠닀"λŠ” 의미λ₯Ό λ‹΄κ³  μžˆμŠ΅λ‹ˆλ‹€.
데뷔와 λ™μ‹œμ— 큰 인기λ₯Ό 끌며 λΉ λ₯΄κ²Œ μ£Όλͺ©λ°›λŠ” κ·Έλ£Ή 쀑 ν•˜λ‚˜λ‘œ 자리 μž‘μ•˜μŠ΅λ‹ˆλ‹€.
멀버 ꡬ성:
μ•ˆμœ μ§„ (리더), 가을, 레이, μž₯μ›μ˜, 리즈, μ΄μ„œ
μ£Όμš” ν™œλ™ 및 히트곑:
ELEVEN (2021λ…„): λ°λ·”κ³‘μœΌλ‘œ, μ„Έλ ¨λœ νΌν¬λ¨ΌμŠ€μ™€ λ©œλ‘œλ””λ‘œ λ§Žμ€ μ‚¬λž‘μ„ λ°›μ•˜μŠ΅λ‹ˆλ‹€.
LOVE DIVE (2022λ…„): 쀑독성 μžˆλŠ” λ©œλ‘œλ””μ™€ 맀혹적인 μ½˜μ…‰νŠΈλ‘œ 큰 인기λ₯Ό μ–»μœΌλ©° μŒμ•…λ°©μ†‘μ—μ„œ λ‹€μˆ˜μ˜ 1μœ„λ₯Ό μ°¨μ§€ν–ˆμŠ΅λ‹ˆλ‹€.
After LIKE (2022λ…„): 'LOVE DIVE'에 이어 히트λ₯Ό 친 곑으둜, μ•„μ΄λΈŒμ˜ κ°œμ„±μ„ 더 ν™•κ³ νžˆ ν•˜λŠ” κ³‘μ΄μ—ˆμŠ΅λ‹ˆλ‹€.
μ•„μ΄λΈŒλŠ” λ…νŠΉν•œ μ½˜μ…‰νŠΈμ™€ λ›°μ–΄λ‚œ λ¬΄λŒ€ 퍼포먼슀둜 κ΅­λ‚΄μ™Έ νŒ¬λ“€μ—κ²Œ μ‚¬λž‘λ°›κ³  있으며, 각 멀버듀 μ—­μ‹œ κ°œλ³„μ μΈ 맀λ ₯을 λ°œμ‚°ν•˜λ©° ν™œλ°œνžˆ ν™œλ™ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.
μž₯μ›μ˜κ³Ό μ•ˆμœ μ§„μ€ 데뷔 μ „λΆ€ν„° μ•„μ΄μ¦ˆμ› ν™œλ™μ„ 톡해 μ£Όλͺ©λ°›μ•˜μœΌλ©°, 이후 μ•„μ΄λΈŒλ‘œμ„œλ„ 성곡적인 ν™œλ™μ„ 이어가고 μžˆμŠ΅λ‹ˆλ‹€.

Question1: μ•„μ΄λΈŒμ˜ λ¦¬λ”λŠ” λˆ„κ΅¬μ•Ό?
Answer1: μ•ˆμœ μ§„

Question2: μ•„μ΄λΈŒ 데뷔곑 μ•Œλ €μ€˜.
Answer2: ELEVEN
```
## μ—°λ½μ²˜
- njsung1217@gmail.com
- https://github.com/nakjun