Instructions to use dg845/DiffusionGemma-diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use dg845/DiffusionGemma-diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("dg845/DiffusionGemma-diffusers", torch_dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse filesAdd initial description for repo
README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: diffusers
|
| 3 |
+
---
|
| 4 |
+
`diffusers`-native checkpoint for the [google/diffusiongemma-26B-A4B-it](https://huggingface.co/google/diffusiongemma-26B-A4B-it) discrete diffusion LLM.
|
| 5 |
+
|
| 6 |
+
You can use the model as follows. Note that you need `transformers>=5.12.0` for the underlying `DiffusionGemmaForBlockDiffusion` model.
|
| 7 |
+
|
| 8 |
+
```python
|
| 9 |
+
import torch
|
| 10 |
+
from diffusers import DiffusionGemmaPipeline
|
| 11 |
+
|
| 12 |
+
pipe = DiffusionGemmaPipeline.from_pretrained(
|
| 13 |
+
"dg845/DiffusionGemma-diffusers",
|
| 14 |
+
torch_dtype=torch.bfloat16,
|
| 15 |
+
)
|
| 16 |
+
pipe.to("cuda")
|
| 17 |
+
|
| 18 |
+
# Compile the decoder model for faster inference
|
| 19 |
+
pipe.model.model.decoder = torch.compile(pipe.model.model.decoder, mode="reduce-overhead"),
|
| 20 |
+
|
| 21 |
+
output = pipe(
|
| 22 |
+
prompt="Why is the sky blue?",
|
| 23 |
+
gen_length=256,
|
| 24 |
+
num_inference_steps=48,
|
| 25 |
+
cache_implementation="static",
|
| 26 |
+
generator=torch.Generator("cuda").manual_seed(42),
|
| 27 |
+
)
|
| 28 |
+
print(output.texts[0])
|
| 29 |
+
```
|