Cashel/diffusion-chatbot

Space

0

stars

7

commits

3

linked in READMEs

Sep 6, 2026

updated

docker

README

🤖 Diffusion Chatbot

Docker Python

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

GET /health

2. Generate Text (Simple)

POST /generate
Content-Type: application/json

{
  "prompt": "Your question here",
  "max_new_tokens": 256
}

3. Generate with Real-time Streaming (SSE) ⭐

POST /generate_sse
Content-Type: application/json

{
  "prompt": "Your question here",
  "max_new_tokens": 100,
  "capture_interval": 10
}

💡 Example Usage

# 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

ComponentTechnology
Modeldllm-hub/Qwen3-0.6B-diffusion-bd3lm-v0.1
FrameworkFlask + PyTorch
MethodBlock Diffusion Language Model (BD3LM)
Base ModelQwen

⚙️ Configuration

VariableDescriptionDefault
MODEL_NAMEHuggingFace model namedllm-hub/Qwen3-0.6B-diffusion-bd3lm-v0.1
PORTServer port7860

🧠 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

Contributors

Cashel

6 commits

HD

Cashel/diffusion-chatbot

Space

0

stars

7

commits

3

linked in READMEs

Sep 6, 2026

updated

docker

README

🤖 Diffusion Chatbot

Docker Python

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

GET /health

2. Generate Text (Simple)

POST /generate
Content-Type: application/json

{
  "prompt": "Your question here",
  "max_new_tokens": 256
}

3. Generate with Real-time Streaming (SSE) ⭐

POST /generate_sse
Content-Type: application/json

{
  "prompt": "Your question here",
  "max_new_tokens": 100,
  "capture_interval": 10
}

💡 Example Usage

# 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

ComponentTechnology
Modeldllm-hub/Qwen3-0.6B-diffusion-bd3lm-v0.1
FrameworkFlask + PyTorch
MethodBlock Diffusion Language Model (BD3LM)
Base ModelQwen

⚙️ Configuration

VariableDescriptionDefault
MODEL_NAMEHuggingFace model namedllm-hub/Qwen3-0.6B-diffusion-bd3lm-v0.1
PORTServer port7860

🧠 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

Contributors

Cashel

6 commits

HD