Instructions to use Grizzlykw/d1-qwen with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Grizzlykw/d1-qwen with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Grizzlykw/d1-qwen", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Grizzlykw/d1-qwen", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
d1-qwen-0.6b
Experimental text decision model based on Qwen3-0.6B. A trained compatibility head reads the backbone's last input-token representation. It returns decisions without generating answer tokens. The original Qwen backbone weights stay frozen.
The API follows the text classification portion of LiquidAI d1. This is an independent implementation. It does not use LiquidAI weights or claim d1 benchmark performance.
Load and decide
Install CPU PyTorch and the dependencies from the project requirements. Then:
import torch
from transformers import AutoModel
torch.set_num_threads(2)
model = AutoModel.from_pretrained(
"models/d1-qwen-0.6b", trust_remote_code=True, dtype=torch.float32,
local_files_only=True,
)
out = model.system_one("I was charged twice. Please refund the extra payment.", {
"team": {
"type": "choice",
"instructions": "Which support team should handle this message?",
"criteria": {
"billing": "Charges, payments, invoices, and refunds",
"shipping": "Delivery, tracking, parcels, and shipping",
"technical": "Software bugs, crashes, and application faults",
"account": "Login, passwords, profiles, and account access",
},
},
"billing": {
"type": "noul",
"instructions": "Does this message concern charges, payments, invoices, or refunds?",
},
})
print(out)
noul returns noul, a probability of yes. choice takes a dictionary of named
descriptions and returns choice, confidence, and probabilities. Set
multiple: True to obtain independent probabilities and a choices list using
a 0.5 threshold. score takes 2 to 10 descriptions ordered lowest first and
returns the median level as a zero-based score, its confidence, probabilities,
and a legend. A state may be text or a JSON value.
system_one_batch([(state, questions), ...]) batches requests into one forward
call. Each question/option gets an independent input row. The state is repeated
for each candidate; this implementation does not share d1's state computation.
usage.input_tokens counts those repeated rows and usage.output_tokens is zero.
Memory grows with the number of candidates, so split large workloads into calls.
Training and evaluation
Training uses the supplied decision JSONL splits. Their sizes, measured results,
and file hashes are recorded in training_report.json; source metadata is in
dataset_manifest.json when provided. The project also includes a synthetic
reference starter with 320 training and 80 decisions per held-out split. Those
counts do not describe runs using downloaded or uploaded datasets.
Training updates the 1,025 parameters of a linear compatibility head. Its initial weight is Qwen's Yes-minus-No output embedding direction. Frozen Qwen features come from a frozen backbone on the selected device. CPU extraction uses packed FP16 linear weights with float32 activations. CUDA defaults to FP16 autocast for the backbone; FP32 is also available, and BF16 requires supporting hardware. The head and grouped losses use float32 on the selected device. MPS uses FP32. Training uses cross-entropy for exclusive choices and binary cross-entropy for independent decisions, with a penalty on deviation from the initial head. Calibration loss selects the head checkpoint and a scalar temperature. The test split never selects parameters.
training_report.json contains measured baseline and trained results, data
hashes, the selected epoch, and temperature. Accuracy is per decision; multiple
choices require the entire predicted set to match. Brier results combine binary
and multiclass tasks, and are for within-run comparison. Calibration-set results
are optimistic because the same split selects the checkpoint and temperature.
The checkpoint includes its backbone, trained head, tokenizer, custom model code,
license, training data, and report. It loads without the original base directory.
The saved config.decision_autocast_dtype preserves CUDA backbone autocast for
inference, while the decision head remains float32. config.decision_quantize_cpu selects CPU weight packing for models
trained with that feature path. Accelerator-trained models keep it disabled.
feature_device and feature_precision in the report identify the evaluated
training pipeline. Validate accuracy and calibration when changing precision.
Limits
This is a starter model, not a generally validated replacement for d1. Good accuracy on the supplied test split does not establish generalization to real messages, arbitrary questions, other languages, or other domains. Probabilities need validation and calibration on the intended deployment data.
The configured input limit is 512 tokens per candidate row, including the chat
template and question. Longer inputs raise an error rather than silently losing
part of the state. Raising config.decision_max_length permits longer inputs
but does not establish their accuracy.
This checkpoint has no text-span extraction, number/date extraction, numeric estimation, image, video, audio, or bounding-box heads. Unsupported types and media raise errors. It has no generative language head.
- Downloads last month
- 25