Skip to content

feat(anima): Make Anima respect the precision property in Invoke.yaml#9183

Open
kappacommit wants to merge 2 commits into
invoke-ai:mainfrom
kappacommit:anima-precision
Open

feat(anima): Make Anima respect the precision property in Invoke.yaml#9183
kappacommit wants to merge 2 commits into
invoke-ai:mainfrom
kappacommit:anima-precision

Conversation

@kappacommit
Copy link
Copy Markdown
Contributor

@kappacommit kappacommit commented May 15, 2026

Summary

Makes it so that Anima respects the precision property in invoke.yaml

Why?

Anima runs in bf16 precision. This is slow on 2000 series and earlier Nvidia GPUs, and on mac. Allowing the user to configure this, enables that hardware to run the model at adequate performance on those systems.

Why only Anima?

Today - Qwen and Z-Image do not respect the precision property. Which is fine, because neither Z-Image nor Qwen support fp16 at all (it produces broken output.) If we make Z-Image and Qwen respect precision, they will break if set to float16 and if set to float32 they will double their VRAM cost and realistically not be usable on consumer hardware. (Qwen will take >40gb of VRAM)

Anima, SD, and Flux 1 are the only models which safely and feasibly support all precisions. So it is natural to add Anima to the list.

I have documented an issue here for a more robust fix for all models by implementing a similar fix to how Forge and Comfy both handle this automatically. However, testing this is difficult. It requires testing on many different devices (2000 series nvidia gpu, mac): #9153

QA Instructions

  1. Generate an image with anima, you will use this as a reference for the other steps
  2. In invoke.yaml add precision: float32
  3. Generate the same image with anima (same seed / settings). You will notice 2 things: it should take up 2x the VRAM and likely run a bit slower. You will also notice very slight changes to the output image.
  4. In invoke.yaml add precision: float16
  5. Generate the same image with anima (same seed / settings). You will again notice very slight changes to the image. You likely won't notice much of a VRAM difference this time.

Merge Plan

Standard merge. Backend-only change isolated to Anima paths.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added (4 new unit tests in tests/backend/util/test_devices.py)
  • No redux slice migrations needed
  • No docs needed (internal helper)

🤖 Generated with Claude Code

Your Name and others added 2 commits May 14, 2026 23:38
…sion

When precision='auto', delegates to the existing choose_bfloat16_safe_dtype
probe. When set to a specific value (float16/bfloat16/float32), returns that
dtype directly so the user's config choice is honored. Anima call sites will
migrate to this helper in a follow-up commit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Swaps choose_bfloat16_safe_dtype for choose_anima_inference_dtype at:
- _run_diffusion (transformer / latents / LoRA dtype)
- anima_text_encoder (text-encoder LoRA dtype)
- model_loaders/anima (transformer load dtype)

precision='auto' preserves the current bf16-probe fallback; specific values
are now honored end-to-end.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions github-actions Bot added python PRs that change python files invocations PRs that change invocations backend PRs that change backend files python-tests PRs that change python tests labels May 15, 2026
@kappacommit kappacommit changed the title feat(anima): honor config.precision for Anima dtype selection feat(anima): Make Anima respect the precision property in Invoke.yaml May 15, 2026
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 invocations PRs that change invocations python PRs that change python files python-tests PRs that change python tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant