Text Generation
Transformers
Safetensors
qwen3
diffusion-language-model
masked-diffusion
bidirectional
cid
continuous-interaction-diffusion
research
conversational
custom_code
text-generation-inference
Run this model with HF Jobs
Run fwerkor/Qwen3-4B-Diffusion-Base 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/fwerkor/Qwen3-4B-Diffusion-Base. 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/fwerkor/Qwen3-4B-Diffusion-Base 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/fwerkor/Qwen3-4B-Diffusion-Base. 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/fwerkor/Qwen3-4B-Diffusion-Base. 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 fwerkor/Qwen3-4B-Diffusion-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fwerkor/Qwen3-4B-Diffusion-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fwerkor/Qwen3-4B-Diffusion-Base", trust_remote_code=True) 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("fwerkor/Qwen3-4B-Diffusion-Base", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("fwerkor/Qwen3-4B-Diffusion-Base", trust_remote_code=True, 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 fwerkor/Qwen3-4B-Diffusion-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fwerkor/Qwen3-4B-Diffusion-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fwerkor/Qwen3-4B-Diffusion-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/fwerkor/Qwen3-4B-Diffusion-Base
- SGLang
How to use fwerkor/Qwen3-4B-Diffusion-Base 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 "fwerkor/Qwen3-4B-Diffusion-Base" \ --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": "fwerkor/Qwen3-4B-Diffusion-Base", "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 "fwerkor/Qwen3-4B-Diffusion-Base" \ --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": "fwerkor/Qwen3-4B-Diffusion-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use fwerkor/Qwen3-4B-Diffusion-Base with Docker Model Runner:
docker model run hf.co/fwerkor/Qwen3-4B-Diffusion-Base
Download diffusion_config.json from fwerkor/Qwen3-4B-Diffusion-Base: direct link, hf CLI and curl.
- Browser
- Download file 1.73 kB
-
https://huggingface.co/fwerkor/Qwen3-4B-Diffusion-Base/resolve/main/diffusion_config.json
- Command line
-
hf download hf://fwerkor/Qwen3-4B-Diffusion-Base/diffusion_config.json
-
curl -L -o diffusion_config.json https://huggingface.co/fwerkor/Qwen3-4B-Diffusion-Base/resolve/main/diffusion_config.json
1.73 kB
| { | |
| "format": "cid-diffusion-base-v1", | |
| "base_model": "Qwen/Qwen3-4B-Base", | |
| "objective": "LLaDA-style masked diffusion", | |
| "attention": "bidirectional", | |
| "mask_token": "<|cid_mask|>", | |
| "mask_token_id": 151669, | |
| "sequence_length": 2048, | |
| "completed_steps": 3300, | |
| "global_batch_size": 96, | |
| "mask_ratio_range": [ | |
| 0.001, | |
| 1.0 | |
| ], | |
| "tokens_seen": 648806400, | |
| "training_corpus": { | |
| "format": "cid-diffusion-stream-v1", | |
| "base_model": "Qwen/Qwen3-4B-Base", | |
| "sequence_length": 2048, | |
| "sources": [ | |
| { | |
| "name": "ultrax-web-en", | |
| "repo": "openbmb/UltraX-Preview", | |
| "revision": "a88527587389fd4ab352e9ad1273f4c0a234d8df", | |
| "pattern": "data/UltraX-Ultra-FineWeb/*.parquet", | |
| "column": "cleaned_content", | |
| "weight": 0.7 | |
| }, | |
| { | |
| "name": "ultrafineweb-zh", | |
| "repo": "openbmb/Ultra-FineWeb", | |
| "revision": "02c85641e3d19a854be2e09139c25adaa9518063", | |
| "pattern": "data/ultrafineweb_zh/*.parquet", | |
| "column": "content", | |
| "weight": 0.15 | |
| }, | |
| { | |
| "name": "ultradata-code", | |
| "repo": "openbmb/UltraData-Code", | |
| "revision": "85182d829f2ce7ea07cca72ebfc509deea1d9f5f", | |
| "pattern": "data/UltraData-Code-L2/*/*.parquet", | |
| "column": "content", | |
| "weight": 0.1 | |
| }, | |
| { | |
| "name": "ultradata-math", | |
| "repo": "openbmb/UltraData-Math", | |
| "revision": "fe10db8efd35597fd7fcff8ff576b5ec4ea5ff87", | |
| "pattern": "data/UltraData-Math-L2-preview/*.parquet", | |
| "column": "content", | |
| "weight": 0.05 | |
| } | |
| ] | |
| }, | |
| "hf_loader": "CIDDiffusionForMaskedLM", | |
| "hf_auto_model": "AutoModelForCausalLM", | |
| "requires_trust_remote_code": true | |
| } | |