Repository navigation
SDAI-GLOSS — A Heavy Fork
What's changed
Pipeline
- VaeEncoder encodes the input image (stretched to width x height, NCHW, [-1, 1]) and scales latents by 0.18215. Its session lives only for the encode call, so it never coexists with the UNet.
- EulerAncestral scheduler gains getStartStep(strength) and addNoise(original, noise, stepIndex) = original + noise * sigma.
- UNet.inference takes optional initLatents/strength and loops from startStep using absolute step indices. txt2img is unchanged (startStep = 0, same RNG and scaling).
- LocalDiffusion.processImageToImage, generateFromImage on the repository, result mapper, and ImageToImageUseCaseImpl routing for LOCAL_MICROSOFT_ONNX. Named processImageToImage instead of a process overload so process(any()) stays unambiguous in existing mocks.
- FeatureTag.Img2Img and sourceSupportsImageToImage now include ONNX. Inpainting stays hidden for ONNX (masks are not supported).
Encoder delivery
- One shared fp32 encoder (sd-vae-ft-mse, ~137 MB) is downloaded on first use. VaeEncoderDownloader tries VaeEncoderDistribution.SOURCES in order, verifies SHA-256, writes to .part, and renames only after the hash matches. Stored in files/shared/vae_encoder//.
- A vae_encoder/model.ort inside a model folder still overrides it.
- The Img2Img screen asks once (GenerationModal.EncoderDownload), shows progress with cancel, then resumes the pending generation.
- New use cases: IsLocalImageToImageReadyUseCase, DownloadLocalVaeEncoderUseCase. Adds okhttp to feature/onnx.
- New strings (default locale only).
Fixes
- AndroidDownloadableModelFileStore.isDownloaded required exactly four model folders, so adding vae_encoder/ made downloaded ONNX models look missing. The optional vae_encoder folder is now ignored.
- ImageToImageUseCaseImplTest "unsupported source" used LOCAL_MICROSOFT_ONNX; it now uses LOCAL_GOOGLE_MEDIA_PIPE.
UI
- The denoising strength slider is now shown for local ONNX and restyled to match the CFG slider (SliderTextInputField). The restyle applies to every source that shows the slider.
Tests
- Added ONNX routing in ImageToImageUseCaseImplTest and three AndroidDownloadableModelFileStoreTest cases for the optional folder.
- :domain:testDebugUnitTest and :data:testDebugUnitTest pass.
- Verified manually on two devices with aniflatmix, Counterfeit v3.0 and Real Vision, including the fresh-install download path.
Known limitations
- The input image is stretched, not cropped.
- Ancestral sampler noise is unseeded, so a fixed seed does not reproduce exactly (same as txt2img).
- No unit tests yet for the downloader or the new use cases. Download failure paths (cancel, offline, hash mismatch) are not yet exercised.
Android packages
- Release APK:
sdaigloss-1.2.0-release.apk - Debug APK:
sdaigloss-1.2.0-debug.apk
SDAI-GLOSS is not affiliated with, endorsed by, or sponsored by Stability AI, the Stable Diffusion project or SDAI. References to third-party models and services describe compatibility only.