Text Generation
Transformers
Safetensors
English
metadiffusion
diffusion
diffusion-lm
ar-to-diffusion
custom_code
Instructions to use CodeSoft/MetaDiffusion-600M-ChatBase with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CodeSoft/MetaDiffusion-600M-ChatBase with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CodeSoft/MetaDiffusion-600M-ChatBase", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("CodeSoft/MetaDiffusion-600M-ChatBase", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CodeSoft/MetaDiffusion-600M-ChatBase with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CodeSoft/MetaDiffusion-600M-ChatBase" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeSoft/MetaDiffusion-600M-ChatBase", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/CodeSoft/MetaDiffusion-600M-ChatBase
- SGLang
How to use CodeSoft/MetaDiffusion-600M-ChatBase 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 "CodeSoft/MetaDiffusion-600M-ChatBase" \ --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": "CodeSoft/MetaDiffusion-600M-ChatBase", "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 "CodeSoft/MetaDiffusion-600M-ChatBase" \ --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": "CodeSoft/MetaDiffusion-600M-ChatBase", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use CodeSoft/MetaDiffusion-600M-ChatBase with Docker Model Runner:
docker model run hf.co/CodeSoft/MetaDiffusion-600M-ChatBase
Update README.md
Browse files
README.md
CHANGED
|
@@ -74,6 +74,42 @@ print(tok.decode(out[0], skip_special_tokens=True))
|
|
| 74 |
|
| 75 |
```
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
## Limitations
|
| 78 |
|
| 79 |
This model is an experimental research checkpoint intended for further fine-tuning and experimentation. It is not optimized for instruction-following, factuality, safety, or production deployment. Behavior may differ substantially from the original Qwen3-0.6B-Instruct model.
|
|
|
|
| 74 |
|
| 75 |
```
|
| 76 |
|
| 77 |
+
# Chat with it (chat.py)
|
| 78 |
+
```bash
|
| 79 |
+
python3 MetaDiffusion-600M-ChatBase/scripts/chat.py \
|
| 80 |
+
--model-path MetaDiffusion-600M-ChatBase/model.safetensors \
|
| 81 |
+
--tokenizer MetaDiffusion-600M-ChatBase/tokenizer \
|
| 82 |
+
--im-end-bias 2.0 --im-end-bias-t 0.3 --watch
|
| 83 |
+
```
|
| 84 |
+
## Fine-tune (train.py)
|
| 85 |
+
|
| 86 |
+
```bash
|
| 87 |
+
# 1. Init: convert the AR model to a diffusion init
|
| 88 |
+
python scripts/convert.py --source Qwen/Qwen3-0.6B \
|
| 89 |
+
--output init/metadiffusion-600M-instruct.pt \
|
| 90 |
+
--tokenizer-out data/tokenizer
|
| 91 |
+
|
| 92 |
+
# 2. Corpus: smol, opc, math and no_robots, or a local --jsonl of {"messages": [...]} rows.
|
| 93 |
+
# --val-fraction holds out a disjoint val set for early stopping.
|
| 94 |
+
python scripts/prepare_data.py --datasets smol,math --out data \
|
| 95 |
+
--val-fraction 0.05
|
| 96 |
+
|
| 97 |
+
# 3. Train (defaults: lr 5e-5, bf16, seq 512, batch auto-detected)
|
| 98 |
+
python scripts/train.py --init-checkpoint init/metadiffusion-600M-instruct.pt \
|
| 99 |
+
--data-dir data --output-dir checkpoints --max-steps 30000
|
| 100 |
+
|
| 101 |
+
# 4. Continue a run: checkpoints carry model + optimizer + scheduler
|
| 102 |
+
# state, so --resume-from picks up LR position and momentum exactly
|
| 103 |
+
python scripts/train.py --init-checkpoint init/metadiffusion-600M-instruct.pt \
|
| 104 |
+
--data-dir data --output-dir checkpoints_p3 \
|
| 105 |
+
--resume-from checkpoints_p2/step_20000.pt --max-steps 16000
|
| 106 |
+
|
| 107 |
+
# 5. Test, then ship
|
| 108 |
+
python scripts/chat.py --model-path checkpoints_p3/step_30000.pt \
|
| 109 |
+
--tokenizer data/tokenizer --watch
|
| 110 |
+
python scripts/export_hf.py --checkpoint checkpoints_p3/step_30000.pt \
|
| 111 |
+
--tokenizer data/tokenizer --output MetaDiffusion-600M-ChatBase
|
| 112 |
+
```
|
| 113 |
## Limitations
|
| 114 |
|
| 115 |
This model is an experimental research checkpoint intended for further fine-tuning and experimentation. It is not optimized for instruction-following, factuality, safety, or production deployment. Behavior may differ substantially from the original Qwen3-0.6B-Instruct model.
|