Qwen3-8B base model üzerinde FinAgent-TR dataset ile fine-tune edilmiş Türkçe LoRA adapter'ıdır. Finansal okuryazarlık soruları, tool selection, tool call generation ve tool output'a dayalı response generation için...
Fuente del modelo
Descripción de la fuente
Qwen3-8B base model üzerinde FinAgent-TR dataset ile fine-tune edilmiş Türkçe LoRA adapter'ıdır. Finansal okuryazarlık soruları, tool selection, tool call generation ve tool output'a dayalı response generation için eğitildi.
pip install -U unsloth peft transformers accelerate bitsandbytes
Fuentes
1 fuenteVerificado 30 ago
Artefactos del modelo
1 artefactoExtractos de fuentes
2 extractosimport torch
from unsloth import FastLanguageModel
MODEL_ID = "Dbmaxwell/finagent-tr-qwen3-8b-unsloth-lora"
model, tokenizer = FastLanguageModel.from_pretrained(
model_name=MODEL_ID,
max_seq_length=1024,
load_in_4bit=True,
)
FastLanguageModel.for_inference(model)
messages = [
{
"role": "system",
"content": "Türkçe finansal okuryazarlık asistanısın. Net ve dayanaklı yanıt ver.",
},
{
"role": "user",
"content": "50.000 TL yıllık yüzde 10 bileşik faizle iki yıl sonunda kaç TL olur?",
},
]
input_ids = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
enable_thinking=False,
return_tensors="pt",
).to(model.device)
with torch.inference_mode():
output_ids = model.generate(
input_ids,
max_new_tokens=256,
do_sample=True,
temperature=0.7,
top_p=0.8,
top_k=20,
pad_token_id=tokenizer.eos_token_id,
)
answer = tokenizer.decode(
output_ids[0, input_ids.shape[-1]:],
skip_special_tokens=True,
)
print(answer)
Tool'lar model tarafından çalıştırılmaz. Model tool call üretir; tool execution ve tool output'un conversation'a tool message olarak eklenmesi agent runtime'ın sorumluluğundadır.
Tool schema'ları Qwen3 chat template'ine tools parametresiyle verilir:
tools = [
{
"type": "function",
"function": {
"name": "tefas_price",
"description": "TEFAS fon fiyatını getirir.",
"parameters": {
"type": "object",
"properties": {
"as_of": {
"type": "string",
"description": "ISO tarih",
},
"range": {
"type": "string",
"enum": ["narrow", "wide"],
},
},
"additionalProperties": False,
},
},
}
]
messages = [
{
"role": "system",
"content": "Güncel finans verisi gereken sorularda uygun aracı kullan.",
},
{
"role": "user",
"content": "Fonun 2025-01-15 tarihindeki fiyatını kontrol eder misin?",
},
]
input_ids = tokenizer.apply_chat_template(
messages,
tools=tools,
tokenize=True,
add_generation_prompt=True,
enable_thinking=False,
return_tensors="pt",
).to(model.device)
Bu input'tan sonra standard model.generate() flow kullanılabilir. Üretilen tool name ve arguments, execution öncesinde application layer'da validate edilmelidir.
Dbmaxwell/finagent-trq_proj, k_proj, v_proj, o_proj3e-5Evaluation, 100 test episode ve 5.836 supervised assistant token üzerinde yapıldı. Base model ve fine-tuned model aynı tokenizer, 4-bit quantization, loss masking ve test split ile ölçüldü. Base-model baseline için yalnızca LoRA adapter geçici olarak disable edildi.
| Model | Test loss | Perplexity |
|---|---|---|
| Qwen3-8B base | 3.1655 | 23.70 |
| FinAgent-TR fine-tuned LoRA | 1.5700 | 4.81 |
Fine-tuned model, base model'e göre:
Bu sonuç teacher-forced next-token prediction ve in-distribution generalization ölçümüdür. Tek başına end-to-end agent accuracy anlamına gelmez.
Training dataset: Dbmaxwell/finagent-tr
Bu adapter Apache 2.0 license altında paylaşıldı. Base model license için Qwen3-8B model card sayfasını inceleyin.
--- base_model: unsloth/qwen3-8b-unsloth-bnb-4bit library_name: peft pipeline_tag: text-generation license: apache-2.0 language: - tr datasets: - Dbmaxwell/finagent-tr tags: - qwen3 - unsloth - lora - qlora - turkish - finance - tool-calling --- # FinAgent-TR Qwen3-8B LoRA Qwen3-8B base model üzerinde FinAgent-TR dataset ile fine-tune edilmiş Türkçe LoRA adapter'ıdır. Finansal okuryazarlık soruları, tool selection, tool call generation ve tool output'a dayalı response generation için eğitildi. ## Installation ```bash pip install -U unsloth peft transformers accelerate bitsandbytes ``` ## Inference ```python import torch from unsloth import FastLanguageModel MODEL_ID = "Dbmaxwell/finagent-tr-qwen3-8b-unsloth-lora" model, tokenizer = FastLanguageModel.from_pretrained( model_name=MODEL_ID, max_seq_length=1024, load_in_4bit=True, ) FastLanguageModel.for_inference(model) messages = [ { "role": "system", "content": "Türkçe finansal okuryazarlık asistanısın. Net ve dayanaklı yanıt ver.", }, { "role": "user", "content": "50.000 TL yıllık yüzde 10 bileşik faizle iki yıl sonunda kaç TL olur?", }, ] input_ids = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, enable_thinking=False, return_tensors="pt", ).to(model.device) with torch.inference_mode(): output_ids = model.generate( input_ids, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.8, top_k=20, pad_token_id=tokenizer.eos_token_id, ) answer = tokenizer.decode( output_ids[0, input_ids.shape[-1]:], skip_special_tokens=True, ) print(answer) ``` ## Tool Calling Tool'lar model tarafından çalıştırılmaz. Model tool call üretir; tool execution ve tool output'un conversation'a `tool` message olarak eklenmesi agent runtime'ın sorumluluğundadır. Tool schema'ları Qwen3 chat template'ine `tools` parametresiyle verilir: ```python tools = [ { "type": "function", "function": { "name": "tefas_price", "description": "TEFAS fon fiyatını getirir.", "parameters": { "type": "object", "properties": { "as_of": { "type": "string", "description": "ISO tarih", }, "range": { "type": "string", "enum": ["narrow", "wide"], }, }, "additionalProperties": False, }, }, } ] messages = [ { "role": "system", "content": "Güncel finans verisi gereken sorularda uygun aracı kullan.", }, { "role": "user", "content": "Fonun 2025-01-15 t...
Source context: 15 downloads · 0 likes · Pipeline text-generation · Library peft · Repo Dbmaxwell/finagent-tr-qwen3-8b-unsloth-lora