Views
No views yet
Input Image → VLM Analysis → Enhanced Prompts → Diffusion SR → Output Image
↑ ↓ ↓ ↓ ↑
└─── RAM Tags ←─── LoRA Adapt ←─── Scale Chain ←─── Iterate1# Install requirements
2pip install transformers diffusers torch accelerate bitsandbytes
3
4# Load DIFFUSION model
5from transformers import AutoModel, BitsAndBytesConfig
6import torch
7
8# Configure quantization
9quantization_config = BitsAndBytesConfig(
10 load_in_8bit=True,
11 llm_int8_threshold=6.0
12)
13
14# Load quantized model
15model = AutoModel.from_pretrained(
16 "humbleakh/stable-diffusion-8bit-chain-of-zoom",
17 quantization_config=quantization_config,
18 device_map="auto",
19 torch_dtype=torch.bfloat16
20)| Metric | Original | 8-bit Quantized | Improvement |
|---|---|---|---|
| Memory Usage | 5.2GB | 2.6GB | 50% reduction |
| Parameters | 2.6B (FP16) | 2.6B (8-bit) | Same functionality |
| Quality Score | 100% | 95%+ | Minimal degradation |
| Inference Speed | 1.0x | 2.5x | Faster processing |
| Colab Compatible | ❌ (OOM) | ✅ (T4 GPU) | Production ready |
1# Diffusion Integration
2from chain_of_zoom import ChainOfZoom8BitOptimal
3
4# Initialize pipeline
5pipeline = ChainOfZoom8BitOptimal()
6
7# Load your image
8from PIL import Image
9image = Image.open("low_res_image.jpg")
10
11# Run super-resolution
12results = pipeline.chain_of_zoom(image, target_scale=8)
13final_image = results[-1]['image']
14final_image.save("super_resolved_8x.jpg")1torch>=2.0.0
2transformers>=4.36.0
3diffusers>=0.21.0
4bitsandbytes>=0.46.0
5accelerate>=0.20.0
6pillow>=9.0.0
7numpy>=1.21.01@misc{chain_of_zoom_diffusion_8_bit,
2 title={Chain-of-Zoom DIFFUSION 8-bit Quantized Model},
3 author={Chain-of-Zoom Team},
4 year={2024},
5 howpublished={\url{https://huggingface.co/humbleakh/stable-diffusion-8bit-chain-of-zoom}},
6 note={Optimal quantization for super-resolution pipeline}
7}