Update README.md
Browse files
README.md
CHANGED
@@ -9,8 +9,76 @@ tags:
|
|
9 |
- unsloth
|
10 |
- qwen2
|
11 |
- trl
|
|
|
12 |
---
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
# Uploaded model
|
15 |
|
16 |
- **Developed by:** SejongKRX
|
@@ -19,4 +87,4 @@ tags:
|
|
19 |
|
20 |
This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
21 |
|
22 |
-
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
9 |
- unsloth
|
10 |
- qwen2
|
11 |
- trl
|
12 |
+
- krx
|
13 |
---
|
14 |
|
15 |
+
# Usage:
|
16 |
+
|
17 |
+
Sejong-Qwen-v4_inference.ipynb: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ZPKpQntzEAfVdWABDV_OfHDqriQ5HBF-?usp=sharing)
|
18 |
+
|
19 |
+
|
20 |
+
``` python
|
21 |
+
!pip install transformers einops accelerate
|
22 |
+
!pip install qwen
|
23 |
+
!pip install unsloth
|
24 |
+
|
25 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
26 |
+
|
27 |
+
# ν ν¬λμ΄μ μ λͺ¨λΈ λ‘λ
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
29 |
+
"SejongKRX/Sejong-Qwen-4",
|
30 |
+
trust_remote_code=True,
|
31 |
+
use_fast=False
|
32 |
+
)
|
33 |
+
model = AutoModelForCausalLM.from_pretrained(
|
34 |
+
"SejongKRX/Sejong-Qwen-4",
|
35 |
+
trust_remote_code=True
|
36 |
+
)
|
37 |
+
|
38 |
+
# μ
λ ₯ ν
μ€νΈ
|
39 |
+
input_text = """
|
40 |
+
λ€μ μ€ ννμ μκ°κ°μΉμ κ΄ν μ€λͺ
μΌλ‘ μ³μ§ μμ κ²μ 무μμΈκ°?
|
41 |
+
|
42 |
+
A. μ 볡리μ κ²½μ°, 맀μ μ μ©λλ μ΄μμ¨μ μ°κ° λͺ
λͺ© μ΄μμ¨μ 1/12λ‘ λλμ΄ μ°μΆνλ€.
|
43 |
+
B. ν¬μ μκΈ λ° κΈ°ν μ‘°κ±΄μ΄ λμΌν κ²½μ°, λ¨λ¦¬ λ°©μλ³΄λ€ λ³΅λ¦¬ λ°©μμμ λ°μνλ μ΄μκ° λ ν¬λ€.
|
44 |
+
C. μΌμλΆλ‘ μ§κΈλ κΈμ‘μ νμ¬ κ°μΉλ λ―Έλ κ°μΉλ₯Ό μΌμ κΈ°κ° λμ ν μΈμ¨μ μ μ©ν΄ μ°μΆν μ μλ€.
|
45 |
+
D. 1,000,000μμ μ° 5% λ³΅λ¦¬λ‘ 2λ
λμ μμΉνμ κ²½μ°, λ§κΈ°μ λ°μ μΈμ μ΄μλ 100,000μμ΄λ€.
|
46 |
+
|
47 |
+
### μ λ΅:
|
48 |
+
"""
|
49 |
+
|
50 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
51 |
+
|
52 |
+
# λͺ¨λΈμ μ¬μ©νμ¬ ν
μ€νΈ μμ±
|
53 |
+
output = model.generate(**inputs, max_new_tokens=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 |
+
```
|
72 |
+
|
73 |
+
|
74 |
+
# Dataset
|
75 |
+
|
76 |
+
λ³Έ λͺ¨λΈμ λ€μν μΆμ²μ λ°μ΄ν°(mlabonne/open-perfectblend, Wikipedia, νκ΅μνμ 곡곡 λ°μ΄ν° λ±)λ₯Ό νμ©νμ¬ νμ΅λμμΌλ©°, λͺ¨λ λ°μ΄ν°λ μ μκΆ λ° μ¬μ© μ μ±
μ λ°λΌ μ μ ν μ¬μ©λμμ΅λλ€.
|
77 |
+
|
78 |
+
- Wikipedia λ°μ΄ν°λ CC BY-SA 4.0 λΌμ΄μ μ€λ₯Ό λ°λ¦
λλ€. μμΈν μ 보λ [μ¬κΈ°](https://creativecommons.org/licenses/by-sa/4.0/)μμ νμΈν μ μμ΅λλ€.
|
79 |
+
- νκ΅μνμ λ°μ΄ν°λ νκ΅μνμ [μ μκΆ λ³΄νΈλ°©μΉ¨](https://www.bok.or.kr)μ λ°λΌ μ¬μ©λμμ΅λλ€.
|
80 |
+
- [mlabonne/open-perfectblend](https://huggingface.co/datasets/mlabonne/open-perfectblend) λ°μ΄ν°λ Apache 2.0 λΌμ΄μ μ€λ₯Ό λ°λ¦
λλ€. λΌμ΄μ μ€μ λν μμΈν λ΄μ©μ [Apache 2.0 λΌμ΄μ μ€](https://www.apache.org/licenses/LICENSE-2.0)μμ νμΈν μ μμ΅λλ€.
|
81 |
+
|
82 |
# Uploaded model
|
83 |
|
84 |
- **Developed by:** SejongKRX
|
|
|
87 |
|
88 |
This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
89 |
|
90 |
+
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|