Conversation
…oaders Flux2 loaded the text encoder and full-mode VAE encoder from the raw metadata.json name, bypassing the .aimodel -> .aimodelc fallback. On a compiled iOS bundle those URLs point at a missing file, and AIModel(contentsOf:) neither returns nor throws, so the app hangs at 0% CPU. The unchecked full-mode encoder also made supportsImageToImage report true for a missing file. - Guard CoreAIDiffusionModelFunction.loadResources/hasFunction with a file-existence check that throws instead of hanging (covers all diffusion pipelines). - Flux2: resolve the text encoder via ModelBundle.resolveAssetURL and report a missing component up front; resolve + existence-check the optional encoder so supportsImageToImage is truthful. - Wan: resolve components via ModelBundle.resolveAssetURL. - Tests for the missing-file guard and the .aimodel -> .aimodelc fallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #230.
Flux2 built the text encoder and full-mode VAE encoder URLs from the raw
metadata.jsonname, bypassing the.aimodel→.aimodelcfallback used for theother components. On a compiled iOS bundle those paths point at a missing asset;
AIModel(contentsOf:)then stalls without returning or throwing, so the pipelinehangs at load. The unchecked encoder also let
supportsImageToImagereporttruefor an absent file.
CoreAIDiffusionModelFunctionchecks the asset exists before loading and throwsmodelFileNotFound, so a missing component surfaces a clear error instead ofhanging. This covers every diffusion pipeline.
ModelBundle.resolveAssetURLand reports amissing text encoder up front; the optional encoder is resolved and
existence-checked so
supportsImageToImageis accurate.ModelBundle.resolveAssetURL..aimodel→.aimodelcfallback.Verified with
swift test. On-device verification against a compiled FLUX.2 Kleinbundle is still pending.