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|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Dream-org/Dream-v0-Instruct-7B
|
| 4 |
+
tags:
|
| 5 |
+
- fp8
|
| 6 |
+
- quantized
|
| 7 |
+
- llmcompressor
|
| 8 |
+
- tevunahai
|
| 9 |
+
- professional-grade
|
| 10 |
+
- diffusion-lm
|
| 11 |
+
- dream
|
| 12 |
+
- dllm
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Dream-v0-Instruct-7B-FP8
|
| 16 |
+
|
| 17 |
+
## TevunahAi Professional Quantization
|
| 18 |
+
|
| 19 |
+
**🏆 First FP8 quantized Dream model for native PyTorch/transformers inference.**
|
| 20 |
+
|
| 21 |
+
This is an FP8 quantized version of [Dream-v0-Instruct-7B](https://huggingface.co/Dream-org/Dream-v0-Instruct-7B),
|
| 22 |
+
a diffusion-based large language model from HKU NLP Group.
|
| 23 |
+
|
| 24 |
+
### What is Dream?
|
| 25 |
+
|
| 26 |
+
Dream 7B is a **Diffusion Large Language Model (dLLM)** - unlike traditional autoregressive models
|
| 27 |
+
(GPT, LLaMA, Claude) that generate text left-to-right one token at a time, Dream uses
|
| 28 |
+
**parallel denoising** to refine the entire sequence simultaneously.
|
| 29 |
+
|
| 30 |
+
Key advantages:
|
| 31 |
+
- 🔄 **Bidirectional context modeling** - considers full context in both directions
|
| 32 |
+
- 🎯 **Flexible text generation order** - not constrained to left-to-right
|
| 33 |
+
- 🧠 **Superior planning abilities** - excels at tasks requiring multi-step reasoning
|
| 34 |
+
- ⚡ **Adjustable quality-speed tradeoff** - control inference steps for your needs
|
| 35 |
+
|
| 36 |
+
### Quantization Details
|
| 37 |
+
|
| 38 |
+
| Property | Value |
|
| 39 |
+
|----------|-------|
|
| 40 |
+
| Original Model | Dream-v0-Instruct-7B |
|
| 41 |
+
| Quantization | FP8 Dynamic (Weight-only) |
|
| 42 |
+
| Method | llmcompressor FP8_DYNAMIC |
|
| 43 |
+
| Calibration | Data-free |
|
| 44 |
+
| Hardware | Dual Xeon Max 9480 + RTX 5000 Ada |
|
| 45 |
+
| Quantization Time | 1.7 minutes |
|
| 46 |
+
|
| 47 |
+
### Memory Comparison
|
| 48 |
+
|
| 49 |
+
| Precision | Size | VRAM Required |
|
| 50 |
+
|-----------|------|---------------|
|
| 51 |
+
| BF16 | ~14 GB | ~16 GB |
|
| 52 |
+
| **FP8** | **~8.7 GB** | **~10 GB** |
|
| 53 |
+
|
| 54 |
+
### Usage
|
| 55 |
+
|
| 56 |
+
```python
|
| 57 |
+
import torch
|
| 58 |
+
from transformers import AutoModel, AutoTokenizer
|
| 59 |
+
|
| 60 |
+
model_path = "TevunahAi/Dream-v0-Instruct-7B-FP8"
|
| 61 |
+
|
| 62 |
+
model = AutoModel.from_pretrained(
|
| 63 |
+
model_path,
|
| 64 |
+
torch_dtype=torch.bfloat16,
|
| 65 |
+
trust_remote_code=True,
|
| 66 |
+
device_map="auto"
|
| 67 |
+
)
|
| 68 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 69 |
+
|
| 70 |
+
messages = [
|
| 71 |
+
{"role": "user", "content": "Explain quantum computing in simple terms."}
|
| 72 |
+
]
|
| 73 |
+
|
| 74 |
+
inputs = tokenizer.apply_chat_template(
|
| 75 |
+
messages,
|
| 76 |
+
return_tensors="pt",
|
| 77 |
+
return_dict=True,
|
| 78 |
+
add_generation_prompt=True
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
input_ids = inputs.input_ids.to(model.device)
|
| 82 |
+
attention_mask = inputs.attention_mask.to(model.device)
|
| 83 |
+
|
| 84 |
+
# Dream uses diffusion_generate, not generate!
|
| 85 |
+
output = model.diffusion_generate(
|
| 86 |
+
input_ids,
|
| 87 |
+
attention_mask=attention_mask,
|
| 88 |
+
max_new_tokens=256,
|
| 89 |
+
steps=256,
|
| 90 |
+
temperature=0.3,
|
| 91 |
+
top_p=0.95,
|
| 92 |
+
alg="entropy",
|
| 93 |
+
alg_temp=0.,
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
# Decode and clean up response
|
| 97 |
+
response = tokenizer.decode(output[0][input_ids.shape[1]:].tolist())
|
| 98 |
+
response = response.split("<|endoftext|>")[0].strip()
|
| 99 |
+
print(response)
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
### Generation Parameters
|
| 103 |
+
|
| 104 |
+
| Parameter | Description | Recommended |
|
| 105 |
+
|-----------|-------------|-------------|
|
| 106 |
+
| `steps` | Number of diffusion steps (quality vs speed) | 128-512 |
|
| 107 |
+
| `max_new_tokens` | Maximum tokens to generate | 256-512 |
|
| 108 |
+
| `temperature` | Randomness (lower = more deterministic) | 0.2-0.5 |
|
| 109 |
+
| `top_p` | Nucleus sampling threshold | 0.9-0.95 |
|
| 110 |
+
| `alg` | Decoding algorithm | "entropy" |
|
| 111 |
+
| `alg_temp` | Algorithm temperature | 0.0 |
|
| 112 |
+
|
| 113 |
+
**Tips:**
|
| 114 |
+
- More `steps` = higher quality but slower
|
| 115 |
+
- For math/code: use lower temperature (0.1-0.2)
|
| 116 |
+
- For creative tasks: use higher temperature (0.5-0.7)
|
| 117 |
+
|
| 118 |
+
### Important Notes
|
| 119 |
+
|
| 120 |
+
1. ⚠️ **Use `diffusion_generate()`** not `generate()` - Dream is a diffusion model!
|
| 121 |
+
2. Requires `trust_remote_code=True` for custom model code
|
| 122 |
+
3. Stop token cleanup: split response on `<|endoftext|>`
|
| 123 |
+
4. Context length: 2048 tokens
|
| 124 |
+
|
| 125 |
+
### Verified Working
|
| 126 |
+
|
| 127 |
+
```
|
| 128 |
+
Input: "What is 2+2? Answer briefly."
|
| 129 |
+
Output: "4"
|
| 130 |
+
✓ Correct!
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
### Credits
|
| 134 |
+
|
| 135 |
+
- **Original Model**: [Dream-org / HKU NLP Group](https://huggingface.co/Dream-org) - Pioneering diffusion-based language models
|
| 136 |
+
- **Quantization**: [TevunahAi](https://tevunah.ai) - Professional AI model quantization services
|
| 137 |
+
- **Method**: [llmcompressor](https://github.com/vllm-project/llm-compressor) by vLLM Project
|
| 138 |
+
|
| 139 |
+
### Citation
|
| 140 |
+
|
| 141 |
+
If you use Dream, please cite the original paper:
|
| 142 |
+
|
| 143 |
+
```bibtex
|
| 144 |
+
@article{dream2025,
|
| 145 |
+
title={Dream 7B: Diffusion Large Language Models},
|
| 146 |
+
author={Ye, Jiacheng and Xie, Zhihui and others},
|
| 147 |
+
journal={arXiv preprint},
|
| 148 |
+
year={2025}
|
| 149 |
+
}
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
### License
|
| 153 |
+
|
| 154 |
+
Apache 2.0 (same as original Dream model)
|
| 155 |
+
|
| 156 |
+
---
|
| 157 |
+
|