|
--- |
|
license: apache-2.0 |
|
language: |
|
- ko |
|
- en |
|
base_model: |
|
- unsloth/Qwen2.5-7B |
|
tags: |
|
- krx |
|
--- |
|
|
|
Sejong-Qwen-test-v1_inference.ipynb: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ZIjsV-zHNXOKOk03PCrJiAdG8I8JlqHh?usp=sharing) |
|
|
|
# Usage: |
|
|
|
|
|
``` python |
|
!pip install transformers einops accelerate |
|
!pip install qwen |
|
!pip install unsloth |
|
|
|
from transformers import AutoTokenizer, AutoModelForCausalLM |
|
|
|
# ν ν¬λμ΄μ μ λͺ¨λΈ λ‘λ |
|
tokenizer = AutoTokenizer.from_pretrained( |
|
"SejongKRX/Sejong-Qwen-v1", |
|
trust_remote_code=True, |
|
use_fast=False |
|
) |
|
model = AutoModelForCausalLM.from_pretrained( |
|
"SejongKRX/Sejong-Qwen-v1", |
|
trust_remote_code=True |
|
) |
|
|
|
# μ
λ ₯ ν
μ€νΈ |
|
input_text = """ |
|
λ€μ μ€ ννμ μκ°κ°μΉμ κ΄ν μ€λͺ
μΌλ‘ μ³μ§ μμ κ²μ 무μμΈκ°? |
|
|
|
A. μ 볡리μ κ²½μ°, 맀μ μ μ©λλ μ΄μμ¨μ μ°κ° λͺ
λͺ© μ΄μμ¨μ 1/12λ‘ λλμ΄ μ°μΆνλ€. |
|
B. ν¬μ μκΈ λ° κΈ°ν μ‘°κ±΄μ΄ λμΌν κ²½μ°, λ¨λ¦¬ λ°©μλ³΄λ€ λ³΅λ¦¬ λ°©μμμ λ°μνλ μ΄μκ° λ ν¬λ€. |
|
C. μΌμλΆλ‘ μ§κΈλ κΈμ‘μ νμ¬ κ°μΉλ λ―Έλ κ°μΉλ₯Ό μΌμ κΈ°κ° λμ ν μΈμ¨μ μ μ©ν΄ μ°μΆν μ μλ€. |
|
D. 1,000,000μμ μ° 5% λ³΅λ¦¬λ‘ 2λ
λμ μμΉνμ κ²½μ°, λ§κΈ°μ λ°μ μΈμ μ΄μλ 100,000μμ΄λ€. |
|
|
|
### μ λ΅: |
|
""" |
|
|
|
# ν ν°ν λ° μ
λ ₯ ν
μλ₯Ό GPUλ‘ μ΄λ |
|
inputs = tokenizer(input_text, return_tensors="pt").to("cuda") |
|
|
|
# λͺ¨λΈμ μ¬μ©νμ¬ ν
μ€νΈ μμ± |
|
output = model.generate(**inputs, max_length=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 |
|
``` |