Instructions to use freestuff2875/GLM-Image-bnb-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use freestuff2875/GLM-Image-bnb-4bit with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("freestuff2875/GLM-Image-bnb-4bit", 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
- Local Apps Settings
- Draw Things
- DiffusionBee
Update README.md
Browse files
README.md
CHANGED
|
@@ -7,6 +7,36 @@ library_name: diffusers
|
|
| 7 |
pipeline_tag: text-to-image
|
| 8 |
---
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# GLM-Image
|
| 11 |
|
| 12 |
<div align="center">
|
|
|
|
| 7 |
pipeline_tag: text-to-image
|
| 8 |
---
|
| 9 |
|
| 10 |
+
Quantized to nf4 with bitsandbytes. Some sensitive layers left at full precision.
|
| 11 |
+
|
| 12 |
+
Fits comfortably in 16 GB VRAM + 24 GB RAM, might still be able to squeeze it in if you only have 16 GB RAM.
|
| 13 |
+
|
| 14 |
+
Requires:
|
| 15 |
+
```bash
|
| 16 |
+
pip install -U bitsandbytes>=0.46.1
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
Usage:
|
| 20 |
+
```python
|
| 21 |
+
import torch
|
| 22 |
+
from diffusers.pipelines.glm_image import GlmImagePipeline
|
| 23 |
+
|
| 24 |
+
pipe = GlmImagePipeline.from_pretrained("freestuff2875/GLM-Image-bnb-4bit", torch_dtype=torch.bfloat16, device_map="cuda")
|
| 25 |
+
pipe.enable_model_cpu_offload()
|
| 26 |
+
|
| 27 |
+
prompt = "A beautifully designed modern food magazine style dessert recipe illustration, themed around a raspberry mousse cake. The overall layout is clean and bright, divided into four main areas: the top left features a bold black title 'Raspberry Mousse Cake Recipe Guide', with a soft-lit close-up photo of the finished cake on the right, showcasing a light pink cake adorned with fresh raspberries and mint leaves; the bottom left contains an ingredient list section, titled 'Ingredients' in a simple font, listing 'Flour 150g', 'Eggs 3', 'Sugar 120g', 'Raspberry puree 200g', 'Gelatin sheets 10g', 'Whipping cream 300ml', and 'Fresh raspberries', each accompanied by minimalist line icons (like a flour bag, eggs, sugar jar, etc.); the bottom right displays four equally sized step boxes, each containing high-definition macro photos and corresponding instructions, arranged from top to bottom as follows: Step 1 shows a whisk whipping white foam (with the instruction 'Whip egg whites to stiff peaks'), Step 2 shows a red-and-white mixture being folded with a spatula (with the instruction 'Gently fold in the puree and batter'), Step 3 shows pink liquid being poured into a round mold (with the instruction 'Pour into mold and chill for 4 hours'), Step 4 shows the finished cake decorated with raspberries and mint leaves (with the instruction 'Decorate with raspberries and mint'); a light brown information bar runs along the bottom edge, with icons on the left representing 'Preparation time: 30 minutes', 'Cooking time: 20 minutes', and 'Servings: 8'. The overall color scheme is dominated by creamy white and light pink, with a subtle paper texture in the background, featuring compact and orderly text and image layout with clear information hierarchy."
|
| 28 |
+
image = pipe(
|
| 29 |
+
prompt=prompt,
|
| 30 |
+
height=32 * 32,
|
| 31 |
+
width=36 * 32,
|
| 32 |
+
num_inference_steps=50,
|
| 33 |
+
guidance_scale=1.5,
|
| 34 |
+
generator=torch.Generator(device="cuda").manual_seed(42),
|
| 35 |
+
).images[0]
|
| 36 |
+
|
| 37 |
+
image.save("output_t2i.png")
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
# GLM-Image
|
| 41 |
|
| 42 |
<div align="center">
|