Spaces:
Sleeping
Sleeping
File size: 2,930 Bytes
a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 a919dff 0758411 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | ---
title: Diffusion Chatbot
emoji: π€
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: apache-2.0
---
# π€ Diffusion Chatbot
[](https://www.docker.com/)
[](https://www.python.org/)
Flask server hosting the **Qwen3-0.6B-diffusion-bd3lm-v0.1** model with real-time streaming inference. Watch diffusion language models generate text step-by-step!
## β¨ Features
- π― **Real-time Streaming**: Watch the diffusion denoising process live
- π‘ **Three API Endpoints**: Simple generation, batch states, and SSE streaming
- β‘ **GPU Support**: Automatic GPU detection with CPU fallback
- π **Progressive Generation**: See how different parts of text appear at different steps
## π‘ API Endpoints
### 1. Health Check
```bash
GET /health
```
### 2. Generate Text (Simple)
```bash
POST /generate
Content-Type: application/json
{
"prompt": "Your question here",
"max_new_tokens": 256
}
```
### 3. Generate with Real-time Streaming (SSE) β
```bash
POST /generate_sse
Content-Type: application/json
{
"prompt": "Your question here",
"max_new_tokens": 100,
"capture_interval": 10
}
```
## π‘ Example Usage
```bash
# Simple generation
curl -X POST https://YOUR_USERNAME-diffusion-chatbot.hf.space/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "Hello, how are you?", "max_new_tokens": 50}'
# Real-time streaming
curl -N -X POST https://YOUR_USERNAME-diffusion-chatbot.hf.space/generate_sse \
-H "Content-Type: application/json" \
-d '{"prompt": "Write a poem", "max_new_tokens": 100, "capture_interval": 10}'
```
## π§ Technical Details
| Component | Technology |
|-----------|------------|
| **Model** | [dllm-hub/Qwen3-0.6B-diffusion-bd3lm-v0.1](https://huggingface.co/dllm-hub/Qwen3-0.6B-diffusion-bd3lm-v0.1) |
| **Framework** | Flask + PyTorch |
| **Method** | Block Diffusion Language Model (BD3LM) |
| **Base Model** | Qwen |
## βοΈ Configuration
| Variable | Description | Default |
|----------|-------------|---------|
| `MODEL_NAME` | HuggingFace model name | `dllm-hub/Qwen3-0.6B-diffusion-bd3lm-v0.1` |
| `PORT` | Server port | `7860` |
## π§ How It Works
Unlike traditional language models that generate text left-to-right, diffusion language models:
1. Start with all tokens masked
2. Iteratively denoise over multiple steps
3. Generate different parts of text at different steps
4. Create a unique "thought process" visualization
## π Notes
- Model downloads automatically on first run (~1.5GB)
- First request may be slow as model loads
- GPU is optional - automatic CPU fallback
- Lower `capture_interval` = more frequent updates
## π Acknowledgments
- Model: [dllm-hub](https://huggingface.co/dllm-hub)
- Framework: [dLLM](https://github.com/ZHZisZZ/dllm)
- Base: [Qwen](https://github.com/QwenLM/Qwen)
|