Instructions to use Erland/mini-qwen3-1m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Erland/mini-qwen3-1m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Erland/mini-qwen3-1m") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Erland/mini-qwen3-1m") model = AutoModelForCausalLM.from_pretrained("Erland/mini-qwen3-1m") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Erland/mini-qwen3-1m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Erland/mini-qwen3-1m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Erland/mini-qwen3-1m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Erland/mini-qwen3-1m
- SGLang
How to use Erland/mini-qwen3-1m 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 "Erland/mini-qwen3-1m" \ --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": "Erland/mini-qwen3-1m", "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 "Erland/mini-qwen3-1m" \ --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": "Erland/mini-qwen3-1m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Erland/mini-qwen3-1m with Docker Model Runner:
docker model run hf.co/Erland/mini-qwen3-1m
Mini Qwen3 1M
A tiny Qwen3-compatible causal language model for testing and development. It keeps the Hugging Face Qwen3ForCausalLM architecture and the real Qwen3 tokenizer/chat template, but shrinks the model to about 1.2M parameters with randomly initialized weights.
This model is designed for fast Relax/Megatron/SGLang debugging without pulling large Qwen3 checkpoints into every smoke test. It is intentionally not useful for inference or downstream tasks.
Architecture
| Parameter | Value |
|---|---|
| Parameters | 1,217,608 |
| Model type | qwen3 |
| Hidden size | 8 |
| Layers | 2 |
| Intermediate size | 32 |
| Attention heads | 1 |
| KV heads | 1 |
| Head dimension | 8 |
| Max position embeddings | 4,096 |
| Vocab size | 151,936 |
| Tensor dtype | bfloat16 |
| Tokenizer source | Qwen/Qwen3-0.6B local mirror |
How this model was created
scripts/tools/create_mock_qwen3.py in the Relax ROCm Megatron workspace:
- Loads the tokenizer and config metadata from a local Qwen3-0.6B checkpoint.
- Shrinks the Qwen3 config dimensions to the table above.
- Initializes
Qwen3ForCausalLMwith random weights. - Ties word embeddings and saves the model as safetensors.
- Writes
mock_qwen3_info.jsonwith the exact generation metadata.
The model weights are random. Only tokenizer/chat-template metadata is copied from Qwen3-0.6B.
Reproduction
From the Relax ROCm Megatron repository:
source /vast/users/qirong.ho/miniforge3/etc/profile.d/conda.sh
conda activate relaxrl_rocm
python scripts/tools/create_mock_qwen3.py \
--tokenizer-source /vast/users/qirong.ho/erland/Python_project/relax_e2e_assets/Qwen3-0.6B \
--output-dir /vast/users/qirong.ho/erland/Python_project/relax_e2e_assets/Qwen3-Mock-1M
Relax e2e validation
This checkpoint was validated with the Relax AMD ROCm e2e launcher:
NUM_ROLLOUT=2 SAVE_INTERVAL=1 CKPT_FORMAT=torch_dist NO_SAVE_OPTIM=0 \
WANDB_GROUP="qwen3-mock-1m-tmux-20260531_095214" \
./amd_qwen3_mock_2gpu_e2e.sh
Validation evidence:
- Ray job:
raysubmit_sGx5uTXcKu41nHzL - W&B run:
me4ticfh - completed
Actor training completed step 0/2 - completed
Actor training completed step 1/2 - saved
torch_distcheckpoints at iterations 0 and 1 - checkpoint metadata contains optimizer state keys, including
optimizer.state.exp_avgandoptimizer.state.exp_avg_sq
The e2e validation exercised:
- Hugging Face model load
- SGLang transformers rollout
- Megatron Qwen3Bridge import
- distributed weight update
- optimizer step
- W&B application metrics
- optimizer-inclusive
torch_distcheckpoint save
Intended use
- Fast Relax/Megatron/SGLang startup and integration tests
- ROCm smoke tests where Qwen3 code paths matter more than model quality
- Checkpointing and resume infrastructure checks
- Debugging model-provider, tokenizer, rollout, and weight-sync wiring
Not intended for
- Inference quality evaluation
- Benchmarking Qwen3 capability
- Any downstream task
- Reward/loss quality analysis
Because the model is random and extremely small, generated text is expected to be nonsense. During the validation run, rewards were invalid/negative and advantages collapsed to zero; this is expected for this smoke checkpoint.
- Downloads last month
- 16