Add acceleration/distillation support (Lightning/Turbo/LCM/Hyper-SD)
Per-model `acceleration` config block fuses a distillation LoRA into the
pipeline at load and supplies low step-count / guidance defaults at
generation time, for a 5-10x speedup. Covers video (Wan), image diffusers
(SD/SDXL), and sd.cpp (step/cfg defaults + <lora:> prompt injection).
- New codai/models/acceleration.py: preset catalog (ACCEL_PRESETS),
resolve_acceleration(), apply_accel_to_pipeline() (load->fuse->unload so
it stays orthogonal to per-request character/env LoRAs), accel_call_defaults().
- video.py: fuse accel LoRA after load; _generate_video / _generate_sdcpp_video
use preset steps/guidance (request always wins).
- images.py: _apply_image_acceleration on both diffusers load paths;
_generate_image and _generate_with_sdcpp honour preset steps/guidance.
- main.py: surface `acceleration` as a first-class runtime kwarg.
- admin: persist `acceleration`; new GET /admin/api/accel-presets; models.html
Acceleration/Distillation card (preset dropdown + manual override).
Also fix a latent null-trap: float(cfg.get('balanced_gpu_percent', 80))
crashed when the config stored an explicit null (written by the admin UI for
blank fields) since .get(key, default) returns the stored None. Use `or 80`.
Co-Authored-By:
Claude Opus 4.8 <noreply@anthropic.com>
Showing
codai/models/acceleration.py
0 → 100644
This diff is collapsed.
Please
register
or
sign in
to comment