Qwen-D1 / README.md
StatsGary's picture
Model card covering all formats
322e4bb verified
|
Raw History Blame Contribute Delete
5.46 kB
---
base_model: unsloth/Qwen3.5-4B
tags:
- unsloth
- decision-model
- system-one
- clef
- qwen3_5
- lora
- peft
- safetensors
- gguf
- ollama
- llama.cpp
datasets:
- LocalLLaMA/typed-decisions
---
# Qwen-D1
A decision model fine-tuned from [unsloth/Qwen3.5-4B](https://huggingface.co/unsloth/Qwen3.5-4B) with Unsloth's `FastDecisionModel` on [LocalLLaMA/typed-decisions](https://huggingface.co/datasets/LocalLLaMA/typed-decisions). It reads an input (`state`) and typed questions (`choice`, `noul` yes/no, `score`) and returns calibrated probabilities for every option. It does not generate text: on Ollama and llama.cpp it answers on `/v1/systemone`, not on chat or generate.
## Formats
Each format is in its own folder, so you only download the one you need.
| Folder | Format | Size | Use with |
|---|---|---|---|
| [`unsloth/`](https://huggingface.co/StatsGary/Qwen-D1/tree/main/unsloth) | Unsloth: LoRA adapters + decision head + calibration | 0.2 GB | `FastDecisionModel` (also downloads `unsloth/Qwen3.5-4B`) |
| [`safetensors/`](https://huggingface.co/StatsGary/Qwen-D1/tree/main/safetensors) | Safetensors: merged 16-bit + decision head | 8.8 GB | Unsloth Decision API, `FastDecisionModel` |
| [`gguf/`](https://huggingface.co/StatsGary/Qwen-D1/tree/main/gguf) | GGUF (Q8_0, Q4_K_M) + Ollama `Modelfile` | 7.1 GB | Ollama 0.35+, llama.cpp b11443+ |
<!-- benchmarks:start -->
## Benchmarks
No GPU benchmarks yet. Run the Benchmark section of the notebook to add one.
<!-- benchmarks:end -->
## Unsloth (`unsloth/`)
```python
from unsloth import FastDecisionModel
model, tokenizer = FastDecisionModel.from_pretrained(
"StatsGary/Qwen-D1", subfolder = "unsloth", max_seq_length = 2048, load_in_4bit = True,
)
FastDecisionModel.for_inference(model)
questions = {
"team": {"type": "choice", "instructions": "Which team should handle this?",
"criteria": {"billing": "invoices, payments, refunds", "technical": "bugs, outages, errors"}},
"refund": {"type": "noul", "instructions": "Does the customer ask for a refund?"},
"urgency": {"type": "score", "instructions": "How urgent is this?",
"criteria": ["not urgent", "soon", "today"]},
}
answers = FastDecisionModel.predict(model, tokenizer, "Hi, I was charged twice for invoice #4411. Please refund the duplicate today.", questions)
for name, result in answers.items():
print(name, result["answer"], result["probabilities"])
```
`subfolder` makes Unsloth download only this folder. You can keep fine-tuning from it too.
## Safetensors (`safetensors/`)
Serve it with the Unsloth Decision API (GPU):
```bash
hf download StatsGary/Qwen-D1 --include "safetensors/*" --local-dir qwen-d1
UNSLOTH_SYSTEMONE_MODEL=$PWD/qwen-d1/safetensors unsloth studio -H 0.0.0.0 -p 8888
curl http://localhost:8888/v1/systemone -H "Content-Type: application/json" -d '{
"model": "default",
"state": "Hi, I was charged twice for invoice #4411. Please refund the duplicate today.",
"questions": {
"team": {"type": "choice", "instructions": "Which team should handle this?",
"criteria": {"billing": "invoices, payments, refunds", "technical": "bugs, outages, errors"}},
"refund": {"type": "noul", "instructions": "Does the customer ask for a refund?"},
"urgency": {"type": "score", "instructions": "How urgent is this?", "criteria": ["not urgent", "soon", "today"]}
}
}'
```
Or in Python: `FastDecisionModel.from_pretrained("StatsGary/Qwen-D1", subfolder = "safetensors")`. The decision head lives in
`joint_head.safetensors` + `joint_head_config.json`; a plain `AutoModelForCausalLM` load ignores it.
## Ollama (`gguf/`)
```bash
hf download StatsGary/Qwen-D1 --include "gguf/*" --local-dir qwen-d1
cd qwen-d1/gguf
ollama create qwen-d1 -f Modelfile
curl http://localhost:11434/v1/systemone -H "Content-Type: application/json" -d '{
"model": "qwen-d1",
"state": "Hi, I was charged twice for invoice #4411. Please refund the duplicate today.",
"questions": {
"team": {"type": "choice", "instructions": "Which team should handle this?",
"criteria": {"billing": "invoices, payments, refunds", "technical": "bugs, outages, errors"}},
"refund": {"type": "noul", "instructions": "Does the customer ask for a refund?"},
"urgency": {"type": "score", "instructions": "How urgent is this?", "criteria": ["not urgent", "soon", "today"]}
}
}'
```
The `Modelfile` points at `Q4_K_M`. To use another quantization, edit its `FROM` line. To download a single file,
use `--include "gguf/model-Q8_0.gguf" "gguf/Modelfile"`. Q8_0 stays closest to the PyTorch model; k-quants such as Q4_K_M are
smaller but can shift probabilities and flip close answers.
## llama.cpp (`gguf/`)
```bash
llama-server -m qwen-d1/gguf/model-Q8_0.gguf --port 8080
curl http://localhost:8080/v1/systemone -H "Content-Type: application/json" -d '{
"model": "qwen-d1",
"state": "Hi, I was charged twice for invoice #4411. Please refund the duplicate today.",
"questions": {
"team": {"type": "choice", "instructions": "Which team should handle this?",
"criteria": {"billing": "invoices, payments, refunds", "technical": "bugs, outages, errors"}},
"refund": {"type": "noul", "instructions": "Does the customer ask for a refund?"},
"urgency": {"type": "score", "instructions": "How urgent is this?", "criteria": ["not urgent", "soon", "today"]}
}
}'
```