feat(model): Add Config Option To Enable fp32 Precision For Anima#9116
Open
kappacommit wants to merge 10 commits intoinvoke-ai:mainfrom
Open
feat(model): Add Config Option To Enable fp32 Precision For Anima#9116kappacommit wants to merge 10 commits intoinvoke-ai:mainfrom
kappacommit wants to merge 10 commits intoinvoke-ai:mainfrom
Conversation
added 6 commits
May 3, 2026 14:19
Contributor
Author
|
User confirmed the fix here: https://discord.com/channels/1020123559063990373/1149506274971631688/1500611525810065558 |
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
Adds an
anima_precision: auto | bfloat16 | float32field toinvokeai.yamlso users can force Anima into fp32. Defaultautopreserves today's bf16-with-safe-fallback behavior bit-for-bit;float32flips precision across the whole Anima pipeline — model loader, denoise invocation, and Qwen3 text-encoder LoRA patches.Motivation
On Apple Silicon (MPS), bfloat16 is allocatable but slow, producing ~6x slowdowns vs ComfyUI on the same Anima checkpoint. ComfyUI users work around this with
--force-fp32; this PR is the equivalent escape hatch.Usage:
Why a dedicated field instead of reusing the existing precision?
Flux uses an existing field,
precisionto allow this. However,precision: auto(the default) resolves tofp16 and Anima is bf16-native: fp16's narrower exponent range produces broken output. So a literal "make Anima respect global precision" would silently break Anima for every user on default config.
Extension path for other bf16-native models
Z-Image and Qwen Image currently hardcode bf16 the same way Anima did. Adding the same knob for either is a small mechanical change:
TorchDevice.choose_bfloat16_safe_dtype(device)in that model's loader/invocation withTorchDevice.resolve_model_precision(get_config().z_image_precision, device).No changes to resolve_model_precision itself.
Related Issues / Discussions
Discussed in Discord https://discord.com/channels/1020123559063990373/1149506274971631688/1500552718455148735
QA Instructions
Configure your invoke.yaml:
Restart invoke and generate an image with Anima. Confirm successful generation. Note it may be slower on lower VRAM machines.
Merge Plan
Checklist
What's Newcopy (if doing a release after this PR)