Instructions to use yujiepan/qwen3.8-fp8-tiny-random with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yujiepan/qwen3.8-fp8-tiny-random with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="yujiepan/qwen3.8-fp8-tiny-random") 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("yujiepan/qwen3.8-fp8-tiny-random") model = AutoModelForMultimodalLM.from_pretrained("yujiepan/qwen3.8-fp8-tiny-random", 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 yujiepan/qwen3.8-fp8-tiny-random with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yujiepan/qwen3.8-fp8-tiny-random" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yujiepan/qwen3.8-fp8-tiny-random", "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/yujiepan/qwen3.8-fp8-tiny-random
- SGLang
How to use yujiepan/qwen3.8-fp8-tiny-random 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 "yujiepan/qwen3.8-fp8-tiny-random" \ --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": "yujiepan/qwen3.8-fp8-tiny-random", "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 "yujiepan/qwen3.8-fp8-tiny-random" \ --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": "yujiepan/qwen3.8-fp8-tiny-random", "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 yujiepan/qwen3.8-fp8-tiny-random with Docker Model Runner:
docker model run hf.co/yujiepan/qwen3.8-fp8-tiny-random
This tiny model is intended for debugging. It is randomly initialized using the configuration adapted from Qwen/Qwen3.8-27B-FP8.
Structural comparison with Qwen/Qwen3.8-27B-FP8:
| Feature | Source | Tiny |
|---|---|---|
| Input modalities | Text, image, video | Same |
| Vocabulary | 248,320 | Same; special-token IDs preserved |
| Backbone layers | 64 | 8 |
| Hidden size | 5,120 | 32 |
| Attention Q/KV heads; head dim | 24/4; 256 | 12/2; 128 |
| Attention cycle | 3 linear + 1 full | Same; two complete cycles |
| Linear-attention key/value heads | 16/48 | 2/6 |
| Linear-attention key/value head dim | 128/128 | Same |
| MLP intermediate size | 17,408 | 512 |
| MTP | 1 full-attention layer; shared embeddings | Same |
| Vision layers / hidden size | 27 / 1,152 | 2 / 64 |
| Vision patch / temporal patch / merge | 16 / 2 / 2 | Same |
| Vision output size | 5,120 | 32 |
| Checkpoint format | FP8 language/MTP projections; BF16 vision/gates; 128x128 blocks | Same FP8/BF16 layout; 32x32 blocks |
| File path | Size |
|---|---|
| model.safetensors | 34.1MB |
Example usage:
SGLang
- Runs with TP=2, the embedded NEXTN/MTP layer, and CUDA Graph.
- Verified for text, image-plus-text and video-plus-text on two NVIDIA H20 GPUs; see Test environment for dependency versions.
model_id=yujiepan/qwen3.8-fp8-tiny-random
sglang serve \
--model-path $model_id \
--tp-size 2 \
--fp8-gemm-backend triton \
--moe-runner-backend triton \
--speculative-algorithm NEXTN \
--speculative-num-steps 3 \
--speculative-eagle-topk 1 \
--speculative-num-draft-tokens 4 \
--context-length 4096 \
--max-total-tokens 4096 \
--chunked-prefill-size 512 \
--mem-fraction-static 0.4 \
--cuda-graph-config '{"decode": {"bs": [1, 2, 4, 8]}}' \
--disable-custom-all-reduce
- Transformers
import torch
from PIL import Image
from transformers import AutoProcessor, Qwen3_5ForConditionalGeneration
model_id = "yujiepan/qwen3.8-fp8-tiny-random"
model = Qwen3_5ForConditionalGeneration.from_pretrained(
model_id, dtype=torch.bfloat16, device_map="cuda", attn_implementation="sdpa",
)
processor = AutoProcessor.from_pretrained(model_id)
messages = [{"role": "user", "content": [
{"type": "image", "image": Image.new("RGB", (64, 64), (220, 30, 30))},
{"type": "text", "text": "Describe this image."},
]}]
inputs = processor.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True,
return_dict=True, return_tensors="pt",
).to(model.device)
output = model.generate(**inputs, do_sample=False, max_new_tokens=10)
print(processor.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Codes to create this repo:
Click to expand
import json
from pathlib import Path
import torch
from huggingface_hub import hf_hub_download
from transformers import AutoConfig, AutoModelForImageTextToText, AutoProcessor, GenerationConfig, set_seed
# Creation helpers: pip install git+https://github.com/yujiepan/tiny-random.git
from tiny_random.qwen_utils import add_qwen_mtp, save_random_qwen_checkpoint, compact_qwen_tokenizer, check_qwen_repo_size
source_model_id = "Qwen/Qwen3.8-27B-FP8"
save_folder = "/tmp/yujiepan/qwen38-fp8-tiny-random"
source_revision = '017b9c7af6b5689d5dd426a76e0bc077eb5ca20a'
set_seed(42)
folder = Path(save_folder)
folder.mkdir(parents=True, exist_ok=True)
raw = json.loads(Path(hf_hub_download(source_model_id, "config.json", revision=source_revision)).read_text())
quantization = raw.pop("quantization_config")
quantization["weight_block_size"] = [32, 32]
raw["text_config"].update(
hidden_size=32, head_dim=128, num_hidden_layers=8,
layer_types=(["linear_attention"] * 3 + ["full_attention"]) * 2,
num_attention_heads=12, num_key_value_heads=2,
linear_num_key_heads=2, linear_num_value_heads=6,
linear_key_head_dim=128, linear_value_head_dim=128,
intermediate_size=512,
)
raw["text_config"]["rope_parameters"]["mrope_section"] = [6, 5, 5]
raw["vision_config"].update(depth=2, hidden_size=64, intermediate_size=128, num_heads=2, out_hidden_size=32)
(folder / "config.json").write_text(json.dumps(raw, indent=2))
config = AutoConfig.from_pretrained(folder)
model = AutoModelForImageTextToText.from_config(config, dtype=torch.bfloat16)
add_qwen_mtp(model, model.model.language_model)
save_random_qwen_checkpoint(model, folder, quantization)
raw["quantization_config"] = quantization
(folder / "config.json").write_text(json.dumps(raw, indent=2))
AutoProcessor.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
GenerationConfig.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
compact_qwen_tokenizer(folder)
check_qwen_repo_size(folder)
Printing the model:
Click to expand
Qwen3.8 VL: 8 backbone layers + 1 MTP layer; hidden_size=32
Test environment:
- Pillow: 12.2.0
- accelerate: 1.15.0
- av: 19.0.2
- flashinfer-python: 0.7.2
- huggingface_hub: 1.33.0
- kernels: 0.17.0
- numpy: 2.3.5
- safetensors: 0.8.0
- sglang: 0.5.23.dev384+g9ab74b851
- tiny-random: 0.2.0
- torch: 2.14.1
- torchcodec: 0.17.0
- transformers: 5.19.0
Change log:
- 2026-10-23: Initial version.
- 2026-10-23: Reduced all repo files below 50 MB; GPU-validated TP=2, MTP and CUDA Graph.
This repo is generated by GPT-6.1-Sol
- Downloads last month
- 29