You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Experimental ImageGenerationEngine public API #778
Public experimental API, starting from the prototype's ImageGenerationEngine (reference branch llamadart-media-generation-1efede) and the sketch in #776.
Fix what the prototype exposed:
Global callbacks. stable-diffusion.cpp's progress and log callbacks are process-wide: allow one active generation per process (LlamaStateException) and label progress by phase (loading, encodingPrompt, sampling, decoding), since the callback fires for all of them.
Logs. Route runtime logs through LlamaLogger. The log text is only valid during the callback, so the native side must copy it (tracked in stable-diffusion-native).
Early cancel. stable-diffusion.cpp resets its cancel flag when generation starts; keep a pending cancel on the Dart side and re-apply it.
GPU aborts. Map an iOS Metal command-buffer abort to LlamaInferenceException and keep the engine usable.
Memory preflight. Refuse a model that cannot fit the device with LlamaModelException instead of letting Android kill the process (SD-Turbo on the 6 GB Galaxy A53).
Warm-up. Document the ~19 s first Metal load, or offer warmUp().
Model presets.ImageGenerationModel.sdxs(...) and .sdTurbo(..., taesdPath:) carry required defaults (SDXS needs 1 step, guidance 1); .custom(...) for other checkpoints.
Downloads. Reuse the existing download and cache path, with resume.
Same PR, per AGENTS.md: export from lib/llamadart.dart with Dartdoc, README, website guide and support matrix, CHANGELOG.md and recent-releases.md under Unreleased, the affected SKILL.md, and an example.
Carry-over from the #784 audits (non-blocking there because nothing reached the probe yet; this PR makes it reachable):
Point the Vulkan-loader failure advice in lib/src/backends/stable_diffusion/stable_diffusion_runtime_io.dart to llamadart_stable_diffusion_backends instead of llamadart_native_backends.
Gate x64 CPU builds on AVX2, FMA and F16C (the linux-x64/windows-x64 runtimes use them); an older CPU would crash with SIGILL.
Test that vulkan wins over cpu in a mixed llamadart_stable_diffusion_backends list and that an empty value neither warns nor overrides.
List llamadart_stable_diffusion_backends in the build-hooks key table and document the warn-and-fall-back for unsupported values.
State the minimum OS versions (iOS 16.4, macOS 13.3).
Windows: confirm whether a missing vulkan-1.dll reaches the Vulkan hint (LoadLibrary error 126 may not name it).
PR for this issue — public experimental ImageGenerationEngine API, the audit carry-overs above, docs/skills/changelog, and a command-line example (llamadart_cliimage subcommand or basic_app) that writes a PNG with progress and cancellation (base: feat: add opt-in stable_diffusion native runtime #784's branch).
Activity
leehack commentedon Sep 29, 2026
Carry-over from the #784 audits (non-blocking there because nothing reached the probe yet; this PR makes it reachable):
lib/src/backends/stable_diffusion/stable_diffusion_runtime_io.darttollamadart_stable_diffusion_backendsinstead ofllamadart_native_backends.vulkanwins overcpuin a mixedllamadart_stable_diffusion_backendslist and that an empty value neither warns nor overrides.llamadart_stable_diffusion_backendsin the build-hooks key table and document the warn-and-fall-back for unsupported values.vulkan-1.dllreaches the Vulkan hint (LoadLibrary error 126 may not name it).leehack commentedon Sep 29, 2026
Delivery plan (stacked PRs):
stable_diffusionruntime, hook, pins, probe (base:main).ImageGenerationEngineAPI, the audit carry-overs above, docs/skills/changelog, and a command-line example (llamadart_cliimagesubcommand orbasic_app) that writes a PNG with progress and cancellation (base: feat: add opt-in stable_diffusion native runtime #784's branch).The repo squash-merges, so each child PR is rebased onto
mainand retargeted after its parent merges.feat: experimental on-device image generation (stable_diffusion runti…