Run this model with HF Jobs
Run tiny-random/qwen4-moe on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/tiny-random/qwen4-moe. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/tiny-random/qwen4-moe on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/tiny-random/qwen4-moe. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/tiny-random/qwen4-moe. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use tiny-random/qwen4-moe with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/qwen4-moe with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tiny-random/qwen4-moe")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("tiny-random/qwen4-moe") model = AutoModelForMultimodalLM.from_pretrained("tiny-random/qwen4-moe", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/qwen4-moe with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/qwen4-moe" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/qwen4-moe", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tiny-random/qwen4-moe
- SGLang
How to use tiny-random/qwen4-moe 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/qwen4-moe" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/qwen4-moe", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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/qwen4-moe" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/qwen4-moe", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tiny-random/qwen4-moe with Docker Model Runner:
docker model run hf.co/tiny-random/qwen4-moe
This is a randomly initialized tiny model based on Qwen/Qwen4-35B-A3B for testing and debugging.
| Feature | Source | This repo |
|---|---|---|
| Checkpoint tensor elements | 56.82B BF16, 35 I64 | 5.41M BF16, 35 I64 |
| Safetensors weight files | 113.65 GB (33 files) | 10.86 MB (model.safetensors) |
| Architecture / modalities | Qwen4MoE; text, image, video | Same |
| Vocabulary / tied embeddings | 248,320 / false | Same |
| Backbone layers / hidden size | 40 / 2,048 | 8 / 8 |
| Attention Q/KV heads; head dim | 16/2; 256 | 16/2; 32 |
| Attention cycle | 3 linear + 1 QSA | Same; two cycles |
| Linear key/value heads; head dim | 16/32; 128 | 4/8; 32 |
| Routed experts / top-k | 256 / 8 | 32 / 8 |
| Expert/shared intermediate size | 512 / 512 | 128 / 128 |
| Hyper-Connections / mixing rank | 4 / 256 | 4 / 4 |
| QSA heads / dimension / token budget / compression | 4 / 128 / 2,048 / 4 | Same |
| PLE layer / n-gram orders / heads per order | 2 / 2,3 / 8 | Same |
| PLE rows / embedding columns / dtype | 160,003,584 / 128 / BF16 | 9,216 / 1 / BF16 |
| PLE hash bucket base | 10,000,000 | 512; official prime layout |
| PLE convolution / serialized table shards | 4 / 128 | Same |
| MTP | 1 QSA layer; HC fusion; shared token embeddings | Same |
| Vision depth / hidden size / output size | 27 / 1,152 / 2,048 | 2 / 64 / 8 |
| Vision patch / temporal patch / merge | 16 / 2 / 2 | Same |
PLE retains the source n-gram orders, head count, hash/prime-layout algorithm, projections and dilated convolution with reduced auxiliary hash capacity. The main token vocabulary and ids are unchanged. Interleaved M-RoPE follows the shrunk 32-wide head: its 8 rotary values are split as [2, 1, 1] instead of [11, 11, 10].
The tiny checkpoint keeps the source loader contract: Qwen4MoeForConditionalGeneration, the untied BF16 token embedding/head, the 128-way sharded PLE table and the mtp.* weight schema. Transformers main has the native implementation; public vLLM and SGLang main do not yet include a qwen4_moe model, and the SGLang qwen4 branch aliases this model type to its Qwen4Exp runtime.
| File path | Size |
|---|---|
| model.safetensors | 10.9MB |
Example usage
Transformers (β verified)
Requires a Transformers build with native Qwen4 MoE support (tested with the 5.27.0 development snapshot) and the source remote-code processor (trust_remote_code=True). The untied BF16 embedding and LM head are fixed 248,320-row source interfaces.
def run_model(model_id: str) -> None:
import numpy as np
import torch
from PIL import Image
from transformers import AutoProcessor, Qwen4MoeForConditionalGeneration
from transformers.video_utils import VideoMetadata
model_id = str(model_id)
model = Qwen4MoeForConditionalGeneration.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="cuda",
attn_implementation="sdpa",
use_kernels=False,
)
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
image = Image.new("RGB", (64, 64), (220, 30, 30))
# Four predecoded RGB frames, with timestamps supplied through video_metadata.
video = np.stack(
[
np.asarray(Image.new("RGB", (64, 64), color))
for color in [(220, 30, 30), (30, 220, 30), (30, 30, 220), (220, 220, 30)]
]
)
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "video", "video": video},
{"type": "text", "text": "Describe the image and the video."},
],
}
]
inputs = processor.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt",
do_sample_frames=False,
video_metadata=[VideoMetadata(total_num_frames=4, fps=2, frames_indices=[0, 1, 2, 3])],
).to(model.device)
# The timestamps are already encoded in the prompt tokens; generation only
# consumes the model's declared forward inputs.
inputs.pop("video_metadata", None)
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))
if __name__ == "__main__":
run_model(model_id="tiny-random/qwen4-moe")
SGLang serving (β verified)
SGLang main does not contain a qwen4_moe implementation; the public qwen4 branch maps this model type to its Qwen4Exp runtime (pinned at commit b69214f35e86050e9e7663fefb0836c2b630b323). The branch declares sglang-kernel==0.4.11 and requires FlashInfer 0.7.4. This example was verified on an H20 with SGLang's default FA3 attention backend and default CUDA-graph configuration (prefill breakable, decode full); the PLE table stays in host memory through SGLang's default pinned offload. On a host whose driver predates CUDA 13 (such as the R535 nodes used here), put a CUDA 13 compatibility library first on LD_LIBRARY_PATH.
pip install 'sglang @ git+https://github.com/sgl-project/sglang@b69214f35e86050e9e7663fefb0836c2b630b323'
sglang serve --model-path tiny-random/qwen4-moe --served-model-name qwen4-moe-tiny-random \
--host 127.0.0.1 --port 30000 --trust-remote-code \
--context-length 2048 --mem-fraction-static 0.25 --max-running-requests 4
The tiny checkpoint is random-initialized, so generation is not meaningful; this checks that the released tensor layout loads and runs.
Creating this repo
- Code: .meta/create_model.py
- Model structure: .meta/model.log
- Environment: .meta/env.json
Change log
- 2026-12-04: Initial tiny Qwen4 MoE checkpoint (text, image and video).
This repo is generated by DeepSeek-V4.1-Flash.
- Downloads last month
- -
Model tree for tiny-random/qwen4-moe
Base model
Qwen/Qwen4-35B-A3B