Instructions to use tiny-random/qwen3.8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/qwen3.8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tiny-random/qwen3.8") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("tiny-random/qwen3.8") model = AutoModelForMultimodalLM.from_pretrained("tiny-random/qwen3.8", 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 = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/qwen3.8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/qwen3.8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/qwen3.8", "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/tiny-random/qwen3.8
- SGLang
How to use tiny-random/qwen3.8 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 "tiny-random/qwen3.8" \ --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": "tiny-random/qwen3.8", "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 "tiny-random/qwen3.8" \ --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": "tiny-random/qwen3.8", "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 tiny-random/qwen3.8 with Docker Model Runner:
docker model run hf.co/tiny-random/qwen3.8
Upload folder using huggingface_hub
Browse files- README.md +14 -9
- config.json +2 -2
- model.safetensors +2 -2
- tokenizer.json +2 -2
README.md
CHANGED
|
@@ -13,7 +13,7 @@ Structural comparison with `Qwen/Qwen3.8-27B`:
|
|
| 13 |
| Input modalities | Text, image, video | Same |
|
| 14 |
| Vocabulary | 248,320 | Same; special-token IDs preserved |
|
| 15 |
| Backbone layers | 64 | 8 |
|
| 16 |
-
| Hidden size | 5,120 |
|
| 17 |
| Attention Q/KV heads; head dim | 24/4; 256 | 12/2; 128 |
|
| 18 |
| Attention cycle | 3 linear + 1 full | Same; two complete cycles |
|
| 19 |
| Linear-attention key/value heads | 16/48 | 2/6 |
|
|
@@ -22,12 +22,12 @@ Structural comparison with `Qwen/Qwen3.8-27B`:
|
|
| 22 |
| MTP | 1 full-attention layer; shared embeddings | Same |
|
| 23 |
| Vision layers / hidden size | 27 / 1,152 | 2 / 64 |
|
| 24 |
| Vision patch / temporal patch / merge | 16 / 2 / 2 | Same |
|
| 25 |
-
| Vision output size | 5,120 |
|
| 26 |
| Checkpoint format | BF16 | Same |
|
| 27 |
|
| 28 |
| File path | Size |
|
| 29 |
|------|------|
|
| 30 |
-
| model.safetensors |
|
| 31 |
|
| 32 |
|
| 33 |
### Example usage:
|
|
@@ -40,9 +40,11 @@ Structural comparison with `Qwen/Qwen3.8-27B`:
|
|
| 40 |
|
| 41 |
```bash
|
| 42 |
model_id=tiny-random/qwen3.8
|
| 43 |
-
|
| 44 |
--model-path $model_id \
|
| 45 |
--tp-size 2 \
|
|
|
|
|
|
|
| 46 |
--speculative-algorithm NEXTN \
|
| 47 |
--speculative-num-steps 3 \
|
| 48 |
--speculative-eagle-topk 1 \
|
|
@@ -91,7 +93,7 @@ import torch
|
|
| 91 |
from huggingface_hub import hf_hub_download
|
| 92 |
from transformers import AutoConfig, AutoModelForImageTextToText, AutoProcessor, GenerationConfig, set_seed
|
| 93 |
# Creation helpers: pip install git+https://github.com/yujiepan/tiny-random.git
|
| 94 |
-
from tiny_random.qwen_utils import add_qwen_mtp, save_random_qwen_checkpoint
|
| 95 |
|
| 96 |
source_model_id = "Qwen/Qwen3.8-27B"
|
| 97 |
save_folder = "/tmp/tiny-random/qwen38"
|
|
@@ -101,7 +103,7 @@ folder = Path(save_folder)
|
|
| 101 |
folder.mkdir(parents=True, exist_ok=True)
|
| 102 |
raw = json.loads(Path(hf_hub_download(source_model_id, "config.json", revision=source_revision)).read_text())
|
| 103 |
raw["text_config"].update(
|
| 104 |
-
hidden_size=
|
| 105 |
layer_types=(["linear_attention"] * 3 + ["full_attention"]) * 2,
|
| 106 |
num_attention_heads=12, num_key_value_heads=2,
|
| 107 |
linear_num_key_heads=2, linear_num_value_heads=6,
|
|
@@ -109,7 +111,7 @@ raw["text_config"].update(
|
|
| 109 |
intermediate_size=512,
|
| 110 |
)
|
| 111 |
raw["text_config"]["rope_parameters"]["mrope_section"] = [6, 5, 5]
|
| 112 |
-
raw["vision_config"].update(depth=2, hidden_size=64, intermediate_size=128, num_heads=2, out_hidden_size=
|
| 113 |
(folder / "config.json").write_text(json.dumps(raw, indent=2))
|
| 114 |
config = AutoConfig.from_pretrained(folder)
|
| 115 |
model = AutoModelForImageTextToText.from_config(config, dtype=torch.bfloat16)
|
|
@@ -117,6 +119,8 @@ add_qwen_mtp(model, model.model.language_model)
|
|
| 117 |
save_random_qwen_checkpoint(model, folder)
|
| 118 |
AutoProcessor.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
|
| 119 |
GenerationConfig.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
|
|
|
|
|
|
|
| 120 |
```
|
| 121 |
|
| 122 |
</details>
|
|
@@ -126,7 +130,7 @@ GenerationConfig.from_pretrained(source_model_id, revision=source_revision).save
|
|
| 126 |
<details><summary>Click to expand</summary>
|
| 127 |
|
| 128 |
```text
|
| 129 |
-
Qwen3.8 VL: 8 backbone layers + 1 MTP layer; hidden_size=
|
| 130 |
```
|
| 131 |
|
| 132 |
</details>
|
|
@@ -149,4 +153,5 @@ Qwen3.8 VL: 8 backbone layers + 1 MTP layer; hidden_size=128
|
|
| 149 |
|
| 150 |
### Change log:
|
| 151 |
|
| 152 |
-
- 2026-10-23: Initial version.
|
|
|
|
|
|
| 13 |
| Input modalities | Text, image, video | Same |
|
| 14 |
| Vocabulary | 248,320 | Same; special-token IDs preserved |
|
| 15 |
| Backbone layers | 64 | 8 |
|
| 16 |
+
| Hidden size | 5,120 | 16 |
|
| 17 |
| Attention Q/KV heads; head dim | 24/4; 256 | 12/2; 128 |
|
| 18 |
| Attention cycle | 3 linear + 1 full | Same; two complete cycles |
|
| 19 |
| Linear-attention key/value heads | 16/48 | 2/6 |
|
|
|
|
| 22 |
| MTP | 1 full-attention layer; shared embeddings | Same |
|
| 23 |
| Vision layers / hidden size | 27 / 1,152 | 2 / 64 |
|
| 24 |
| Vision patch / temporal patch / merge | 16 / 2 / 2 | Same |
|
| 25 |
+
| Vision output size | 5,120 | 16 |
|
| 26 |
| Checkpoint format | BF16 | Same |
|
| 27 |
|
| 28 |
| File path | Size |
|
| 29 |
|------|------|
|
| 30 |
+
| model.safetensors | 18.2MB |
|
| 31 |
|
| 32 |
|
| 33 |
### Example usage:
|
|
|
|
| 40 |
|
| 41 |
```bash
|
| 42 |
model_id=tiny-random/qwen3.8
|
| 43 |
+
sglang serve \
|
| 44 |
--model-path $model_id \
|
| 45 |
--tp-size 2 \
|
| 46 |
+
--fp8-gemm-backend triton \
|
| 47 |
+
--moe-runner-backend triton \
|
| 48 |
--speculative-algorithm NEXTN \
|
| 49 |
--speculative-num-steps 3 \
|
| 50 |
--speculative-eagle-topk 1 \
|
|
|
|
| 93 |
from huggingface_hub import hf_hub_download
|
| 94 |
from transformers import AutoConfig, AutoModelForImageTextToText, AutoProcessor, GenerationConfig, set_seed
|
| 95 |
# Creation helpers: pip install git+https://github.com/yujiepan/tiny-random.git
|
| 96 |
+
from tiny_random.qwen_utils import add_qwen_mtp, save_random_qwen_checkpoint, compact_qwen_tokenizer, check_qwen_repo_size
|
| 97 |
|
| 98 |
source_model_id = "Qwen/Qwen3.8-27B"
|
| 99 |
save_folder = "/tmp/tiny-random/qwen38"
|
|
|
|
| 103 |
folder.mkdir(parents=True, exist_ok=True)
|
| 104 |
raw = json.loads(Path(hf_hub_download(source_model_id, "config.json", revision=source_revision)).read_text())
|
| 105 |
raw["text_config"].update(
|
| 106 |
+
hidden_size=16, head_dim=128, num_hidden_layers=8,
|
| 107 |
layer_types=(["linear_attention"] * 3 + ["full_attention"]) * 2,
|
| 108 |
num_attention_heads=12, num_key_value_heads=2,
|
| 109 |
linear_num_key_heads=2, linear_num_value_heads=6,
|
|
|
|
| 111 |
intermediate_size=512,
|
| 112 |
)
|
| 113 |
raw["text_config"]["rope_parameters"]["mrope_section"] = [6, 5, 5]
|
| 114 |
+
raw["vision_config"].update(depth=2, hidden_size=64, intermediate_size=128, num_heads=2, out_hidden_size=16)
|
| 115 |
(folder / "config.json").write_text(json.dumps(raw, indent=2))
|
| 116 |
config = AutoConfig.from_pretrained(folder)
|
| 117 |
model = AutoModelForImageTextToText.from_config(config, dtype=torch.bfloat16)
|
|
|
|
| 119 |
save_random_qwen_checkpoint(model, folder)
|
| 120 |
AutoProcessor.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
|
| 121 |
GenerationConfig.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
|
| 122 |
+
compact_qwen_tokenizer(folder)
|
| 123 |
+
check_qwen_repo_size(folder)
|
| 124 |
```
|
| 125 |
|
| 126 |
</details>
|
|
|
|
| 130 |
<details><summary>Click to expand</summary>
|
| 131 |
|
| 132 |
```text
|
| 133 |
+
Qwen3.8 VL: 8 backbone layers + 1 MTP layer; hidden_size=16
|
| 134 |
```
|
| 135 |
|
| 136 |
</details>
|
|
|
|
| 153 |
|
| 154 |
### Change log:
|
| 155 |
|
| 156 |
+
- 2026-10-23: Initial version.
|
| 157 |
+
- 2026-10-23: Reduced all repo files below 50 MB; GPU-validated TP=2, MTP and CUDA Graph.
|
config.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
"full_attention_interval": 4,
|
| 16 |
"head_dim": 128,
|
| 17 |
"hidden_act": "silu",
|
| 18 |
-
"hidden_size":
|
| 19 |
"initializer_range": 0.02,
|
| 20 |
"intermediate_size": 512,
|
| 21 |
"layer_types": [
|
|
@@ -74,7 +74,7 @@
|
|
| 74 |
"model_type": "qwen3_5",
|
| 75 |
"num_heads": 2,
|
| 76 |
"num_position_embeddings": 2304,
|
| 77 |
-
"out_hidden_size":
|
| 78 |
"patch_size": 16,
|
| 79 |
"spatial_merge_size": 2,
|
| 80 |
"temporal_patch_size": 2
|
|
|
|
| 15 |
"full_attention_interval": 4,
|
| 16 |
"head_dim": 128,
|
| 17 |
"hidden_act": "silu",
|
| 18 |
+
"hidden_size": 16,
|
| 19 |
"initializer_range": 0.02,
|
| 20 |
"intermediate_size": 512,
|
| 21 |
"layer_types": [
|
|
|
|
| 74 |
"model_type": "qwen3_5",
|
| 75 |
"num_heads": 2,
|
| 76 |
"num_position_embeddings": 2304,
|
| 77 |
+
"out_hidden_size": 16,
|
| 78 |
"patch_size": 16,
|
| 79 |
"spatial_merge_size": 2,
|
| 80 |
"temporal_patch_size": 2
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:45266a20a08495d89509458cd2caf93f6946e1e34d260a281511c645a6ee6a3a
|
| 3 |
+
size 18219872
|
tokenizer.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d765ac5a92a75f240af39f9358a09a140216dce113e57754c91042ef8b9e4e8
|
| 3 |
+
size 10079700
|