Instructions to use chen-hao-chao/mdm-prime with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chen-hao-chao/mdm-prime with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="chen-hao-chao/mdm-prime")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("chen-hao-chao/mdm-prime", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use chen-hao-chao/mdm-prime with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "chen-hao-chao/mdm-prime" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chen-hao-chao/mdm-prime", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/chen-hao-chao/mdm-prime
- SGLang
How to use chen-hao-chao/mdm-prime 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 "chen-hao-chao/mdm-prime" \ --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": "chen-hao-chao/mdm-prime", "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 "chen-hao-chao/mdm-prime" \ --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": "chen-hao-chao/mdm-prime", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use chen-hao-chao/mdm-prime with Docker Model Runner:
docker model run hf.co/chen-hao-chao/mdm-prime
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- diffusion
|
| 5 |
+
- discrete
|
| 6 |
+
- image-generation
|
| 7 |
+
- text-generation
|
| 8 |
+
library_name: transformers
|
| 9 |
+
inference: false
|
| 10 |
+
datasets:
|
| 11 |
+
- uoft-cs/cifar10
|
| 12 |
+
- jiachenlei/imagenet
|
| 13 |
+
- Skylion007/openwebtext
|
| 14 |
+
metrics:
|
| 15 |
+
- perplexity
|
| 16 |
+
base_model:
|
| 17 |
+
- kuleshov-group/mdlm-owt
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# MDM-Prime
|
| 21 |
+
|
| 22 |
+
**MDM-Prime** is a discrete diffusion model enhanced with the Partial masking scheme (Prime). It enables fine-grained denoising and improves generation quality across both image and text domains. This model was first proposed in our paper [*Beyond Masked and Unmasked: Discrete Diffusion Models via Partial Masking*](https://arxiv.org/abs/2505.18495).
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## Model Details
|
| 27 |
+
|
| 28 |
+
- **Text Generation**
|
| 29 |
+
- Dataset: openwebtext (OWT)
|
| 30 |
+
- Model Size: 130M
|
| 31 |
+
- Context Length: 1,024
|
| 32 |
+
- **Image Synthesis**
|
| 33 |
+
- Dataset: CIFAR-10, ImageNet-32
|
| 34 |
+
- Model Size: 114M
|
| 35 |
+
- Context Length: 32x32x3
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## How to Use
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
from transformers import AutoModel
|
| 43 |
+
|
| 44 |
+
model = AutoModel.from_pretrained('chen-hao-chao/mdm-prime')
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
For more details, please refer to our github repository: [chen-hao-chao/mdm-prime](https://github.com/chen-hao-chao/mdm-prime).
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
## BibTeX Entry and Citation Information
|
| 52 |
+
|
| 53 |
+
If you find this code implementation useful, please consider citing our paper.
|
| 54 |
+
|
| 55 |
+
```bib
|
| 56 |
+
@article{chao2025mdmprime,
|
| 57 |
+
title={{Beyond Masked and Unmasked: Discrete Diffusion Models via Partial Masking}},
|
| 58 |
+
author={Chen-Hao Chao, Wei-Fang Sun, Hanwen Liang, Chun-Yi Lee, Rahul G. Krishnan},
|
| 59 |
+
journal={\tt arXiv:2505.18495 [cs.LG]},
|
| 60 |
+
year={2025},
|
| 61 |
+
}
|
| 62 |
+
```
|