Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,71 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- ko
|
5 |
+
- en
|
6 |
+
base_model:
|
7 |
+
- unsloth/Qwen2.5-7B
|
8 |
+
tags:
|
9 |
+
- krx
|
10 |
+
---
|
11 |
+
|
12 |
+
Sejong-Qwen-v1_inference.ipynb: [![Open In Colab](https://colab.research.google.com/drive/1ZIjsV-zHNXOKOk03PCrJiAdG8I8JlqHh?usp=sharing)
|
13 |
+
|
14 |
+
# Usage:
|
15 |
+
|
16 |
+
8.7 GBμ GPU RAMμ μ¬μ©νμ¬, Colabμμ T4λ‘ μμ μ μΈ Inferenceκ° κ°λ₯ν©λλ€.
|
17 |
+
|
18 |
+
|
19 |
+
``` python
|
20 |
+
!pip install transformers einops accelerate
|
21 |
+
!pip install qwen
|
22 |
+
!pip install unsloth
|
23 |
+
|
24 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
25 |
+
|
26 |
+
# ν ν¬λμ΄μ μ λͺ¨λΈ λ‘λ
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
28 |
+
"SejongKRX/Sejong-Qwen-v1",
|
29 |
+
trust_remote_code=True,
|
30 |
+
use_fast=False
|
31 |
+
)
|
32 |
+
model = AutoModelForCausalLM.from_pretrained(
|
33 |
+
"SejongKRX/Sejong-Qwen-v1",
|
34 |
+
trust_remote_code=True
|
35 |
+
)
|
36 |
+
|
37 |
+
# μ
λ ₯ ν
μ€νΈ
|
38 |
+
input_text = """
|
39 |
+
λ€μ μ€ ννμ μκ°κ°μΉμ κ΄ν μ€λͺ
μΌλ‘ μ³μ§ μμ κ²μ 무μμΈκ°?
|
40 |
+
|
41 |
+
A. μ 볡리μ κ²½μ°, 맀μ μ μ©λλ μ΄μμ¨μ μ°κ° λͺ
λͺ© μ΄μμ¨μ 1/12λ‘ λλμ΄ μ°μΆνλ€.
|
42 |
+
B. ν¬μ μκΈ λ° κΈ°ν μ‘°κ±΄μ΄ λμΌν κ²½μ°, λ¨λ¦¬ λ°©μλ³΄λ€ λ³΅λ¦¬ λ°©μμμ λ°μνλ μ΄μκ° λ ν¬λ€.
|
43 |
+
C. μΌμλΆλ‘ μ§κΈλ κΈμ‘μ νμ¬ κ°μΉλ λ―Έλ κ°μΉλ₯Ό μΌμ κΈ°κ° λμ ν μΈμ¨μ μ μ©ν΄ μ°μΆν μ μλ€.
|
44 |
+
D. 1,000,000μμ μ° 5% λ³΅λ¦¬λ‘ 2λ
λμ μμΉνμ κ²½μ°, λ§κΈ°μ λ°μ μΈμ μ΄μλ 100,000μμ΄λ€.
|
45 |
+
|
46 |
+
### μ λ΅:
|
47 |
+
"""
|
48 |
+
|
49 |
+
# ν ν°ν λ° μ
λ ₯ ν
μλ₯Ό GPUλ‘ μ΄λ
|
50 |
+
inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
|
51 |
+
|
52 |
+
# λͺ¨λΈμ μ¬μ©νμ¬ ν
μ€νΈ μμ±
|
53 |
+
output = model.generate(**inputs, max_length=1500)
|
54 |
+
|
55 |
+
# κ²°κ³Ό λμ½λ©
|
56 |
+
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
57 |
+
print(generated_text)
|
58 |
+
```
|
59 |
+
|
60 |
+
output:
|
61 |
+
```
|
62 |
+
λ€μ μ€ ννμ μκ°κ°μΉμ κ΄ν μ€λͺ
μΌλ‘ μ³μ§ μμ κ²μ 무μμΈκ°?
|
63 |
+
|
64 |
+
A. μ 볡리μ κ²½μ°, 맀μ μ μ©λλ μ΄μμ¨μ μ°κ° λͺ
λͺ© μ΄μμ¨μ 1/12λ‘ λλμ΄ μ°μΆνλ€.
|
65 |
+
B. ν¬μ μκΈ λ° κΈ°ν μ‘°κ±΄μ΄ λμΌν κ²½μ°, λ¨λ¦¬ λ°©μλ³΄λ€ λ³΅λ¦¬ λ°©μμμ λ°μνλ μ΄μκ° λ ν¬λ€.
|
66 |
+
C. μΌμλΆλ‘ μ§κΈλ κΈμ‘μ νμ¬ κ°μΉλ λ―Έλ κ°μΉλ₯Ό μΌμ κΈ°κ° λμ ν μΈμ¨μ μ μ©ν΄ μ°μΆν μ μλ€.
|
67 |
+
D. 1,000,000μμ μ° 5% λ³΅λ¦¬λ‘ 2λ
λμ μμΉνμ κ²½μ°, λ§κΈ°μ λ°μ μΈμ μ΄μλ 100,000μμ΄λ€.
|
68 |
+
|
69 |
+
### μ λ΅:
|
70 |
+
D
|
71 |
+
```
|