Skip to content

feat(model): Add Config Option To Enable fp32 Precision For Anima#9116

Open
kappacommit wants to merge 10 commits intoinvoke-ai:mainfrom
kappacommit:anima-precision-config
Open

feat(model): Add Config Option To Enable fp32 Precision For Anima#9116
kappacommit wants to merge 10 commits intoinvoke-ai:mainfrom
kappacommit:anima-precision-config

Conversation

@kappacommit
Copy link
Copy Markdown
Contributor

@kappacommit kappacommit commented May 3, 2026

Summary

Adds an anima_precision: auto | bfloat16 | float32 field to invokeai.yaml so users can force Anima into fp32. Default auto preserves today's bf16-with-safe-fallback behavior bit-for-bit; float32 flips 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:

# in invokeai.yaml
anima_precision: float32

Why a dedicated field instead of reusing the existing precision?

Flux uses an existing field, precision to allow this. However, precision: auto (the default) resolves to
fp16 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:

  1. Add a literal alias and field to InvokeAIAppConfig
  2. Replace TorchDevice.choose_bfloat16_safe_dtype(device) in that model's loader/invocation with TorchDevice.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:

  anima_precision: float32

Restart invoke and generate an image with Anima. Confirm successful generation. Note it may be slower on lower VRAM machines.

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions Bot added python PRs that change python files invocations PRs that change invocations backend PRs that change backend files services PRs that change app services python-tests PRs that change python tests docs PRs that change docs labels May 3, 2026
@github-actions github-actions Bot added the frontend PRs that change frontend files label May 3, 2026
@kappacommit
Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend PRs that change backend files docs PRs that change docs frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files python-tests PRs that change python tests services PRs that change app services

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant