File size: 3,621 Bytes
8032c24
 
 
 
 
 
 
 
 
 
 
e69f63d
8032c24
 
 
 
 
 
 
 
 
 
 
e69f63d
 
 
 
33406ac
 
e69f63d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e102188
e69f63d
 
 
e102188
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
---
base_model: SejongKRX/Sejong-Qwen-v1
language:
- en
license: apache-2.0
tags:
- text-generation-inference
- transformers
- unsloth
- qwen2
- trl
- krx
---

# Uploaded  model

- **Developed by:** SejongKRX
- **License:** apache-2.0
- **Finetuned from model :** SejongKRX/Sejong-Qwen-v1

This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.

[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)


# Usage:

Sejong-Qwen-v3_inference.ipynb: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1c1CveM-_JbTM1VXle_2_10brxLZsUXF1?usp=sharing)


``` python
!pip install transformers einops accelerate
!pip install qwen
!pip install unsloth

from transformers import AutoTokenizer, AutoModelForCausalLM

# ν† ν¬λ‚˜μ΄μ €μ™€ λͺ¨λΈ λ‘œλ“œ
tokenizer = AutoTokenizer.from_pretrained(
    "SejongKRX/Sejong-Qwen-3",
    trust_remote_code=True,
    use_fast=False
)
model = AutoModelForCausalLM.from_pretrained(
    "SejongKRX/Sejong-Qwen-3",
    trust_remote_code=True
)

# μž…λ ₯ ν…μŠ€νŠΈ
input_text =  """
λ‹€μŒ 쀑 ν™”νμ˜ μ‹œκ°„κ°€μΉ˜μ— κ΄€ν•œ μ„€λͺ…μœΌλ‘œ μ˜³μ§€ μ•Šμ€ 것은 무엇인가?

A. μ›” 볡리의 경우, 맀월 μ μš©λ˜λŠ” μ΄μžμœ¨μ€ μ—°κ°„ λͺ…λͺ© μ΄μžμœ¨μ„ 1/12둜 λ‚˜λˆ„μ–΄ μ‚°μΆœν•œλ‹€.
B. 투자 μ›κΈˆ 및 기타 쑰건이 동일할 경우, 단리 방식보닀 볡리 λ°©μ‹μ—μ„œ λ°œμƒν•˜λŠ” μ΄μžκ°€ 더 크닀.
C. μΌμ‹œλΆˆλ‘œ 지급될 κΈˆμ•‘μ˜ ν˜„μž¬ κ°€μΉ˜λŠ” 미래 κ°€μΉ˜λ₯Ό 일정 κΈ°κ°„ λ™μ•ˆ ν• μΈμœ¨μ„ μ μš©ν•΄ μ‚°μΆœν•  수 μžˆλ‹€.
D. 1,000,000원을 μ—° 5% 볡리둜 2λ…„ λ™μ•ˆ μ˜ˆμΉ˜ν–ˆμ„ 경우, λ§ŒκΈ°μ— 받을 μ„Έμ „ μ΄μžλŠ” 100,000원이닀.

### μ •λ‹΅:
"""

inputs = tokenizer(input_text, return_tensors="pt")

# λͺ¨λΈμ„ μ‚¬μš©ν•˜μ—¬ ν…μŠ€νŠΈ 생성
output = model.generate(**inputs, max_new_tokens=1500)

# κ²°κ³Ό λ””μ½”λ”©
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
```

output:
```
λ‹€μŒ 쀑 ν™”νμ˜ μ‹œκ°„κ°€μΉ˜μ— κ΄€ν•œ μ„€λͺ…μœΌλ‘œ μ˜³μ§€ μ•Šμ€ 것은 무엇인가?

A. μ›” 볡리의 경우, 맀월 μ μš©λ˜λŠ” μ΄μžμœ¨μ€ μ—°κ°„ λͺ…λͺ© μ΄μžμœ¨μ„ 1/12둜 λ‚˜λˆ„μ–΄ μ‚°μΆœν•œλ‹€.
B. 투자 μ›κΈˆ 및 기타 쑰건이 동일할 경우, 단리 방식보닀 볡리 λ°©μ‹μ—μ„œ λ°œμƒν•˜λŠ” μ΄μžκ°€ 더 크닀.
C. μΌμ‹œλΆˆλ‘œ 지급될 κΈˆμ•‘μ˜ ν˜„μž¬ κ°€μΉ˜λŠ” 미래 κ°€μΉ˜λ₯Ό 일정 κΈ°κ°„ λ™μ•ˆ ν• μΈμœ¨μ„ μ μš©ν•΄ μ‚°μΆœν•  수 μžˆλ‹€.
D. 1,000,000원을 μ—° 5% 볡리둜 2λ…„ λ™μ•ˆ μ˜ˆμΉ˜ν–ˆμ„ 경우, λ§ŒκΈ°μ— 받을 μ„Έμ „ μ΄μžλŠ” 100,000원이닀.

### μ •λ‹΅:
D
```


# Dataset

λ³Έ λͺ¨λΈμ€ λ‹€μ–‘ν•œ 좜처의 데이터(mlabonne/open-perfectblend, Wikipedia, ν•œκ΅­μ€ν–‰μ˜ 곡곡 데이터 λ“±)λ₯Ό ν™œμš©ν•˜μ—¬ ν•™μŠ΅λ˜μ—ˆμœΌλ©°, λͺ¨λ“  λ°μ΄ν„°λŠ” μ €μž‘κΆŒ 및 μ‚¬μš© 정책에 따라 적절히 μ‚¬μš©λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 

- Wikipedia λ°μ΄ν„°λŠ” CC BY-SA 4.0 λΌμ΄μ„ μŠ€λ₯Ό λ”°λ¦…λ‹ˆλ‹€. μžμ„Έν•œ μ •λ³΄λŠ” [μ—¬κΈ°](https://creativecommons.org/licenses/by-sa/4.0/)μ—μ„œ 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.
- ν•œκ΅­μ€ν–‰μ˜ λ°μ΄ν„°λŠ” ν•œκ΅­μ€ν–‰μ˜ [μ €μž‘κΆŒ 보호방침](https://www.bok.or.kr)에 따라 μ‚¬μš©λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
- [mlabonne/open-perfectblend](https://huggingface.co/datasets/mlabonne/open-perfectblend) λ°μ΄ν„°λŠ” Apache 2.0 λΌμ΄μ„ μŠ€λ₯Ό λ”°λ¦…λ‹ˆλ‹€. λΌμ΄μ„ μŠ€μ— λŒ€ν•œ μžμ„Έν•œ λ‚΄μš©μ€ [Apache 2.0 λΌμ΄μ„ μŠ€](https://www.apache.org/licenses/LICENSE-2.0)μ—μ„œ 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.