Text Generation
Transformers
Safetensors
JAX
English
qwen3
sft
knowledge-distillation
reasoning
conversational
text-generation-inference
Instructions to use dragosMediv/Tsum-1-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dragosMediv/Tsum-1-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dragosMediv/Tsum-1-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("dragosMediv/Tsum-1-Instruct") model = AutoModelForCausalLM.from_pretrained("dragosMediv/Tsum-1-Instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use dragosMediv/Tsum-1-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dragosMediv/Tsum-1-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dragosMediv/Tsum-1-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/dragosMediv/Tsum-1-Instruct
- SGLang
How to use dragosMediv/Tsum-1-Instruct 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 "dragosMediv/Tsum-1-Instruct" \ --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": "dragosMediv/Tsum-1-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "dragosMediv/Tsum-1-Instruct" \ --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": "dragosMediv/Tsum-1-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use dragosMediv/Tsum-1-Instruct with Docker Model Runner:
docker model run hf.co/dragosMediv/Tsum-1-Instruct
edit
Browse files- README.md +58 -0
- chat_template.jinja +4 -0
- config.json +52 -0
- generation_config.json +9 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +16 -0
README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
tags:
|
| 7 |
+
- qwen3
|
| 8 |
+
- sft
|
| 9 |
+
- knowledge-distillation
|
| 10 |
+
- reasoning
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Tsum-1-Instruct
|
| 14 |
+
|
| 15 |
+
`608M` instruction-tuned and thinking-capable chat model (`Qwen3ForCausalLM`), SFT + knowledge-distilled from `Zedev-608M-Base`.
|
| 16 |
+
|
| 17 |
+
## Model Specs
|
| 18 |
+
* **Base Model:** `dragosMediv/Zedev-608M-Base` (`step 147,841`, `~19.38B` pretrain tokens)
|
| 19 |
+
* **Architecture:** `Qwen3ForCausalLM` (`607,966,720` params, `16L × 1536D`, `FF=5632`, `12:3` GQA, `HD=128`, `rope_theta=500000.0`, `max_pos=8192`)
|
| 20 |
+
* **SFT / KD Dataset:** `25,000,288` trained assistant tokens across `39,079` conversations (`9,423 × 4,096` packed rows, `segment_ids`-isolated):
|
| 21 |
+
* `72%` (`18.0M` tokens) Instruct chat distilled from `Qwen/Qwen3-4B-Instruct-2507`
|
| 22 |
+
* `28%` (`7.0M` tokens) Reasoning `<|im_thought_start|>...<|im_thought_end|>` traces distilled from `Qwen/Qwen3-4B-Thinking-2507`
|
| 23 |
+
* **Training:** `1` epoch (`1,177` steps, `eff_batch = 32,768`, `lr = 2.5e-5 -> 2.0e-6` cosine), `0.5 × CE + 0.5 × Top-32+Tail KL` (`93.83%` KD aligned, `6.17%` pure CE)
|
| 24 |
+
|
| 25 |
+
## Tokenizer & Special Tokens
|
| 26 |
+
* **Type:** Byte-level BPE, `vocab_size = 64,000`
|
| 27 |
+
* **Special IDs:**
|
| 28 |
+
* `0`: `<|im_start|>` (`bos_token`)
|
| 29 |
+
* `1`: `<|im_end|>` (`eos_token`, `pad_token`)
|
| 30 |
+
* `2`: `<|im_thought_start|>` (start reasoning block)
|
| 31 |
+
* `3`: `<|im_thought_end|>` (end reasoning block)
|
| 32 |
+
* `4`: `<|endoftext|>` (pretraining separator)
|
| 33 |
+
* `5–7`: `<|reserved_1..3|>`
|
| 34 |
+
* **Chat Template:** ChatML (`<|im_start|>role\ncontent<|im_end|>\n`)
|
| 35 |
+
|
| 36 |
+
## Usage
|
| 37 |
+
```python
|
| 38 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 39 |
+
import torch
|
| 40 |
+
|
| 41 |
+
model_id = "dragosMediv/Tsum-1-Instruct"
|
| 42 |
+
tok = AutoTokenizer.from_pretrained(model_id)
|
| 43 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
|
| 44 |
+
|
| 45 |
+
msgs = [{"role": "user", "content": "Explain why the sky looks blue in 3 sentences."}]
|
| 46 |
+
prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
|
| 47 |
+
|
| 48 |
+
inp = tok(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
|
| 49 |
+
out = model.generate(**inp, max_new_tokens=200, temperature=0.55, top_p=0.9, repetition_penalty=1.1, eos_token_id=tok.eos_token_id)
|
| 50 |
+
print(tok.decode(out[0][inp["input_ids"].shape[1]:], skip_special_tokens=False))
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Limitations
|
| 54 |
+
> [!WARNING]
|
| 55 |
+
> * **Small model limits (`608M`, 1 SFT epoch):** Prone to factual hallucinations, flawed arithmetic/algebra (even inside `<|im_thought_start|>` traces), and incorrect code logic despite valid syntax.
|
| 56 |
+
> * **Repetition:** Low-temperature or greedy decoding can fall into repetition loops.
|
| 57 |
+
> * **No safety alignment / DPO:** Trained without RLHF or refusal tuning; may comply with unsafe requests or output biased/unreliable content.
|
| 58 |
+
> * **Context & language:** SFT used a `4,096`-token window (`8,192` max base pos); performance degrades on long dense inputs and non-English languages.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% for m in messages %}<|im_start|>{{ m['role'] }}
|
| 2 |
+
{{ m['content'] }}<|im_end|>
|
| 3 |
+
{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
|
| 4 |
+
{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 1,
|
| 10 |
+
"head_dim": 128,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 1536,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 5632,
|
| 15 |
+
"layer_types": [
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention"
|
| 32 |
+
],
|
| 33 |
+
"max_position_embeddings": 8192,
|
| 34 |
+
"max_window_layers": 28,
|
| 35 |
+
"model_type": "qwen3",
|
| 36 |
+
"num_attention_heads": 12,
|
| 37 |
+
"num_hidden_layers": 16,
|
| 38 |
+
"num_key_value_heads": 3,
|
| 39 |
+
"pad_token_id": 1,
|
| 40 |
+
"rms_norm_eps": 1e-05,
|
| 41 |
+
"rope_parameters": {
|
| 42 |
+
"rope_theta": 500000.0,
|
| 43 |
+
"rope_type": "default"
|
| 44 |
+
},
|
| 45 |
+
"sliding_window": null,
|
| 46 |
+
"tie_word_embeddings": true,
|
| 47 |
+
"transformers_version": "5.22.1",
|
| 48 |
+
"use_cache": true,
|
| 49 |
+
"use_sliding_window": false,
|
| 50 |
+
"vocab_size": 64000,
|
| 51 |
+
"rope_theta": 500000.0
|
| 52 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 0,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": 1,
|
| 5 |
+
"pad_token_id": 1,
|
| 6 |
+
"temperature": 0.6,
|
| 7 |
+
"top_p": 0.9,
|
| 8 |
+
"transformers_version": "5.22.1"
|
| 9 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5275e2dc1edf157b2b722784f9bab6065fa9ec309c82adea88b6ba5aa592424b
|
| 3 |
+
size 2431887048
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<|im_start|>",
|
| 4 |
+
"eos_token": "<|im_end|>",
|
| 5 |
+
"extra_special_tokens": [
|
| 6 |
+
"<|im_thought_start|>",
|
| 7 |
+
"<|im_thought_end|>",
|
| 8 |
+
"<|endoftext|>",
|
| 9 |
+
"<|reserved_1|>",
|
| 10 |
+
"<|reserved_2|>",
|
| 11 |
+
"<|reserved_3|>"
|
| 12 |
+
],
|
| 13 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 14 |
+
"pad_token": "<|im_end|>",
|
| 15 |
+
"tokenizer_class": "TokenizersBackend"
|
| 16 |
+
}
|