Downloads · 30 days
12
27% of all-time downloads
3kd1000/korean-stock-news-qwen-lora
korean-stock-news-qwen-lora is a machine learning model from 3kd1000. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Downloads · 30 days
12
27% of all-time downloads
All-time downloads
45
Public
Repo size
31.6 MB
Likes
0
Public
Click a slice to open those files.
.safetensors20.2 MB · 56%
From the Hugging Face model README
GPT-4o와 동등한 80% 적중률을 달성한 한국 주식 뉴스 분석 모델
Qwen2.5-7B-Instruct를 Knowledge Distillation으로 파인튜닝하여 한국 주식시장 뉴스 분석 및 투자 추천을 수행하는 모델입니다.
| Metric | Score | 비교 |
|---|---|---|
| 전체 적중률 | 80.0% | GPT-4o와 동등 |
| BUY 신호 적중률 | 85.7% | 7건 중 6건 적중 |
| 감정 분석 정확도 | 95.0% | 20건 중 19건 정확 |
| 기업명 추출 F1 | 79.69 | Precision 72.2, Recall 88.8 |
| 비용 절감 | 95%+ | vs GPT-4o API |
입력: "삼성전자 3분기 영업이익 10조원 돌파, 시장 예상 크게 상회"
출력: "긍정"
입력: "삼성전자와 SK하이닉스가 반도체 협력 MOU 체결"
출력: "삼성전자, SK하이닉스"
입력: 주식 관련 뉴스
출력: "높음" / "보통" / "낮음"
출력:
1. 삼성전자 - 매수 - AI 반도체 수요 증가로 실적 개선 전망
2. 현대차 - 매수 - 전기차 판매량 급증으로 성장 가속화
3. 포스코 - 보유 - 철강 가격 상승세이나 원자재 비용 부담
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
# 1. 4bit 양자화 설정 (메모리 절약)
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.float16
)
# 2. 베이스 모델 로드 (4bit 양자화)
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-7B-Instruct",
quantization_config=bnb_config,
device_map="auto",
torch_dtype=torch.float16
)
# 3. LoRA 어댑터 적용
model = PeftModel.from_pretrained(
base_model,
"jsjung00/korean-stock-news-qwen-lora"
)
# 4. 토크나이저 로드
tokenizer = AutoTokenizer.from_pretrained("jsjung00/korean-stock-news-qwen-lora")
# 감정 분석 예시
def analyze_sentiment(news_title, news_content):
system_prompt = "당신은 한국 주식시장 전문 애널리스트입니다."
user_prompt = f'''다음 뉴스의 투자 감정을 분석해주세요. [긍정/중립/부정] 중 하나로만 답변하세요.
제목: {news_title}
내용: {news_content}'''
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
inputs.input_ids,
max_new_tokens=10,
do_sample=False,
temperature=0.1
)
response = tokenizer.decode(outputs[0][len(inputs.input_ids[0]):], skip_special_tokens=True)
return response.strip()
| Task | Metric | Score |
|---|---|---|
| 감정 분석 | Accuracy | 95.0% |
| 기업명 추출 | F1 Score | 79.69 |
| 연관도 분석 | Accuracy | 35.0%* |
*연관도 분석은 "보통" 수준 뉴스도 포함하도록 기준 완화하여 실용성 개선
이 모델은 다음과 같은 프로덕션 시스템에서 활용됩니다:
Apache 2.0
Contact: 투자는 본인 책임하에 진행하시기 바랍니다. 이 모델은 참고용으로만 사용해주세요.