fix(model_manager): detect Flux1/2 VAE by latent space dimensions instead of filename#8790
Merged
lstein merged 6 commits intoinvoke-ai:mainfrom Jan 27, 2026
Merged
Conversation
…d of filename VAE detection previously relied solely on filename pattern matching, which failed for Flux VAE files with generic names like "ae.safetensors". Now probes the model's decoder.conv_in weight shape to determine the latent space dimensions: - 16 channels -> Flux VAE - 4 channels -> SD/SDXL VAE (with filename fallback for SD1/SD2/SDXL distinction)
Extend Flux2 VAE detection to also check for 32-dimensional latent space (decoder.conv_in with 32 input channels) in addition to BatchNorm layers. This provides more robust detection for Flux2 VAE files regardless of filename.
lstein
approved these changes
Jan 27, 2026
Collaborator
lstein
left a comment
There was a problem hiding this comment.
Tested on VAEs from flux.1, flux.2, SDXL and ZiT. Works as advertised.
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.
Summary
VAE detection previously relied on filename pattern matching and BatchNorm layer detection, which could fail for VAE files with generic names. Now probes the model's decoder.conv_in weight shape to determine the latent space dimensions:
Flux2 VAE detection now uses two identification methods:
bn.running_mean,bn.running_var) - unique to Flux2decoder.conv_inwith 32 input channels)Related Issues / Discussions
N/A
QA Instructions
ae.safetensors)Fluxbase typeFlux2base typeMerge Plan
N/A - straightforward change, can merge anytime.
Checklist
What's Newcopy (if doing a release after this PR)