Instructions to use emretmrk/Qwen3.5-4B-TR-Finance with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use emretmrk/Qwen3.5-4B-TR-Finance with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="emretmrk/Qwen3.5-4B-TR-Finance") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("emretmrk/Qwen3.5-4B-TR-Finance") model = AutoModelForCausalLM.from_pretrained("emretmrk/Qwen3.5-4B-TR-Finance", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use emretmrk/Qwen3.5-4B-TR-Finance with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use emretmrk/Qwen3.5-4B-TR-Finance with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "emretmrk/Qwen3.5-4B-TR-Finance" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "emretmrk/Qwen3.5-4B-TR-Finance", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/emretmrk/Qwen3.5-4B-TR-Finance
- SGLang
How to use emretmrk/Qwen3.5-4B-TR-Finance with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "emretmrk/Qwen3.5-4B-TR-Finance" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "emretmrk/Qwen3.5-4B-TR-Finance", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "emretmrk/Qwen3.5-4B-TR-Finance" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "emretmrk/Qwen3.5-4B-TR-Finance", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use emretmrk/Qwen3.5-4B-TR-Finance with Docker Model Runner:
docker model run hf.co/emretmrk/Qwen3.5-4B-TR-Finance
Qwen3.5-4B-TR-Finance
Qwen3.5-4B-TR-Finance is a Turkish and Turkish-finance adapted version of
Qwen/Qwen3.5-4B.
The model was adapted in two sequential stages:
- Domain-Adaptive / Continual Pre-training (DAPT)
- Supervised Fine-Tuning (SFT)
Training focused on improving Turkish language capability, Turkish financial-domain knowledge, and Turkish instruction following.
This repository contains the standalone merged model weights obtained after merging the final LoRA adapter into the upstream model. It is the recommended repository for direct inference and benchmark / leaderboard submission.
Note: Training in this project used text-only Turkish and finance data. The upstream Qwen3.5-4B model is multimodal, but visual capabilities were not explicitly trained or evaluated in this adaptation.
Türkçe Özet
Bu model, Qwen/Qwen3.5-4B modelinin Türkçe dil yeteneğini ve özellikle Türkçe finans alanındaki bilgisini geliştirmek amacıyla iki aşamada eğitilmiştir:
- DAPT / Continual Pre-training: Türkçe finans ve genel Türkçe ham metinleri
- SFT: Türkçe finans soru-cevap / instruction verileri ve genel Türkçe instruction verileri
Bu repo, final LoRA adapter'ın ana modele merge edilmiş standalone model sürümüdür. Benchmark ve doğrudan inference için bu repo önerilir.
Model Details
| Item | Value |
|---|---|
| Upstream model | Qwen/Qwen3.5-4B |
| Training language | Primarily Turkish |
| Domain | General Turkish + Finance |
| Training stages | DAPT → SFT |
| Fine-tuning method | LoRA / PEFT |
| LoRA target | all-linear |
| LoRA rank | 32 |
| LoRA alpha | 64 |
| LoRA dropout | 0.05 |
| Final artifact | Merged standalone weights |
| Main use | Turkish text generation, Turkish finance QA/instruction tasks, benchmarking |
Training
Stage 1 — DAPT / Continual Pre-training
Datasets
Mixture
- 60% Turkish-finance text
- 40% general Turkish text
The 60/40 mixture was constructed on a sample/row basis, not by exact token count.
DAPT hyperparameters
| Parameter | Value |
|---|---|
| Method | BF16/FP16 LoRA |
| Target modules | all-linear |
Rank (r) |
32 |
| LoRA alpha | 64 |
| LoRA dropout | 0.05 |
| Learning rate | 5e-5 |
| Optimizer steps | 1500 |
| Max sequence length | 2048 |
| Packing | No |
| Gradient accumulation | 16 |
| LR scheduler | Cosine |
| Evaluation interval | 100 steps |
| Checkpoint interval | 250 steps |
Stage 2 — Supervised Fine-Tuning
Datasets
SFT data strategy
- All available examples from the two finance datasets were used after filtering.
- Finance training examples were oversampled by approximately 3×.
- Approximately 12k filtered examples from
alpaca-gpt4-trwere used. - Evaluation examples were split before finance oversampling.
- Samples exceeding the configured sequence-length budget were filtered.
SFT hyperparameters
| Parameter | Value |
|---|---|
| Starting point | DAPT-trained LoRA adapter |
| Method | BF16/FP16 LoRA |
| Target modules | all-linear |
Rank (r) |
32 |
| LoRA alpha | 64 |
| LoRA dropout | 0.05 |
| Learning rate | 1e-4 |
| Epochs | 2 |
| Max sequence length | 2048 |
| Packing | No |
| Loss | Completion-only |
| Gradient accumulation | 16 |
| LR scheduler | Cosine |
Training Stack
- Hugging Face Transformers
- TRL
- PEFT
- Accelerate
- Weights & Biases
- TensorBoard
Usage
The upstream Qwen3.5-4B architecture is multimodal. The exact loading API should follow the config.json stored in this repository.
import torch
from transformers import AutoProcessor, AutoModelForMultimodalLM
MODEL_ID = "emretmrk/Qwen3.5-4B-TR-Finance"
processor = AutoProcessor.from_pretrained(MODEL_ID)
model = AutoModelForMultimodalLM.from_pretrained(
MODEL_ID,
torch_dtype="auto",
device_map="auto",
)
messages = [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Türkiye'de enflasyon ile politika faizi arasındaki ilişkiyi açıkla."
}
],
}
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
do_sample=False,
)
answer = processor.decode(
outputs[0][inputs["input_ids"].shape[-1]:],
skip_special_tokens=True,
)
print(answer)
Benchmark / Leaderboard Usage
For benchmark systems that request a Hugging Face model identifier, use this merged model repository:
emretmrk/Qwen3.5-4B-TR-Finance
The separate LoRA adapter repository is intended primarily for reproducibility, continued training, and PEFT-based loading.
Evaluation
Formal benchmark evaluation is performed separately from training.
| Benchmark | Status |
|---|---|
| TurkBench | Pending |
| OpenLLMTurkishLeaderboard | Pending |
| Held-out Turkish Finance QA | Pending |
| Base vs DAPT vs DAPT+SFT comparison | Pending |
Recommended comparison:
Qwen/Qwen3.5-4B- DAPT checkpoint / adapter
- Final DAPT + SFT model
Intended Use
- Turkish text generation
- Turkish instruction following
- Turkish finance-domain question answering
- Turkish financial terminology and domain-language tasks
- Research on continual pre-training, DAPT, LoRA, and SFT
- Benchmarking Turkish language capability
Limitations
- The model may generate incorrect or hallucinated information.
- Financial knowledge can become outdated.
- The model should not be treated as financial, investment, legal, or tax advice.
- Training data may contain noise, inaccuracies, or biases inherited from upstream datasets.
- The adaptation focused on text-only Turkish and finance data; multimodal capabilities were not explicitly optimized or evaluated.
- Benchmark gains should not be assumed until independently measured.
License and Dataset Terms
The upstream Qwen/Qwen3.5-4B model is released under the Apache License 2.0.
This model was trained using third-party datasets. Their individual dataset cards and usage terms should be reviewed separately. Not every upstream dataset card exposes the same level of licensing detail. This repository's license metadata does not override any applicable terms associated with training data.
Acknowledgements
This work builds on:
- Downloads last month
- 91