|
# Phase 4.D: Runtime Optimization for Free CPU Deployment |
|
|
|
## Current Default Settings Analysis |
|
|
|
The CompI Phase 3 Final Dashboard is already well-optimized for free CPU deployment with the following defaults: |
|
|
|
### Model Selection Defaults |
|
- **Base Model**: SD 1.5 (v1-5) - Fast and CPU-friendly |
|
- **Generation Mode**: txt2img - Most efficient mode |
|
- **SDXL**: Available but not default (requires more resources) |
|
|
|
### Image Generation Defaults |
|
- **Width**: 512px (optimal balance of quality/speed) |
|
- **Height**: 512px (standard square format) |
|
- **Steps**: 30 (good quality with reasonable speed) |
|
- **Guidance**: 7.5 (balanced prompt adherence) |
|
- **Batch Size**: 1 (memory efficient) |
|
- **Seed**: 0 (random, no additional computation) |
|
|
|
### Performance Optimizations (Already Enabled) |
|
- **xFormers**: Enabled by default for memory efficiency |
|
- **Attention Slicing**: Enabled to reduce VRAM usage |
|
- **VAE Slicing**: Enabled for memory optimization |
|
- **VAE Tiling**: Available for large images |
|
- **OOM Auto-retry**: Enabled with progressive size reduction |
|
|
|
### Advanced Features (Disabled by Default) |
|
- **ControlNet**: Off by default (users can enable in References tab) |
|
- **LoRA**: Off by default (optional enhancement) |
|
- **Upsampling**: Off by default (2x processing time) |
|
|
|
## CPU-Specific Optimizations |
|
|
|
### Automatic Fallback Sizes |
|
The app includes intelligent OOM recovery with progressive fallbacks: |
|
1. Original size (e.g., 512x512, 30 steps) |
|
2. Half size (384x384, 22 steps) |
|
3. Safe size (384x384, 18 steps) |
|
4. Minimal size (256x256, 14 steps) |
|
|
|
### Fast Preset Available |
|
Users can click "🧼 Reset to defaults" or use the "Fast" preset: |
|
- SD 1.5 model |
|
- 512x512 resolution |
|
- 30 steps |
|
- All optimizations enabled |
|
|
|
## Recommended Settings for Free Tier |
|
|
|
### For Best Performance |
|
``` |
|
Model: SD 1.5 (v1-5) |
|
Resolution: 512x512 or 448x448 |
|
Steps: 20-25 |
|
Guidance: 7.5 |
|
Batch: 1 |
|
ControlNet: Off |
|
LoRA: Off |
|
Upsampling: Off |
|
``` |
|
|
|
### For Higher Quality (Slower) |
|
``` |
|
Model: SD 1.5 (v1-5) |
|
Resolution: 768x512 or 512x768 |
|
Steps: 30-35 |
|
Guidance: 7.0-8.0 |
|
Batch: 1 |
|
ControlNet: Optional |
|
LoRA: Optional (if available) |
|
``` |
|
|
|
## User Guidance in UI |
|
|
|
The app provides helpful guidance: |
|
- VRAM safety indicators with color-coded warnings |
|
- Quick tips in expandable sections |
|
- Preset buttons for common use cases |
|
- Performance optimization toggles with explanations |
|
|
|
## Deployment Considerations |
|
|
|
### Hugging Face Spaces Free Tier |
|
- **CPU**: 2 vCPUs |
|
- **RAM**: 16GB |
|
- **Storage**: 50GB |
|
- **Timeout**: 48 hours idle |
|
|
|
### Expected Performance |
|
- **512x512, 20 steps**: ~30-60 seconds per image |
|
- **768x512, 30 steps**: ~60-120 seconds per image |
|
- **With ControlNet**: +50-100% generation time |
|
- **With LoRA**: +10-20% generation time |
|
|
|
## Monitoring and Optimization |
|
|
|
The dashboard includes: |
|
- Real-time VRAM monitoring (when available) |
|
- Generation time tracking |
|
- Automatic error recovery |
|
- Progressive quality degradation on resource constraints |
|
|
|
## Conclusion |
|
|
|
The CompI Phase 3 Final Dashboard is already optimized for free CPU deployment with: |
|
- Sensible defaults for speed/quality balance |
|
- Automatic fallback mechanisms |
|
- User-friendly performance controls |
|
- Clear guidance for optimization |
|
|
|
No code changes are required for Phase 4.D - the existing defaults are optimal for free tier deployment. |
|
|