Skip to content

Anima from_single_file() fix for models with model.diffusion_model prefix, and strip all llm_adapter keys - #14931

Open
mingyi456 wants to merge 3 commits into
huggingface:mainfrom
mingyi456:anima-single-file-fix
Open

mingyi456 wants to merge 3 commits into
huggingface:mainfrom
mingyi456:anima-single-file-fix

Conversation

@mingyi456

Copy link
Copy Markdown
Contributor

What does this PR do?

Removes the model.diffusion_model prefix from the tensor keys in the CosmosTransformer3DModel.from_single_file() method.

While the Anima base-v1.0 version (and the 3 older preview versions) use the net prefix, the later aesthetic and turbo versions all use the model.diffusion_model prefix, which is not currently supported by the CosmosTransformer3DModel.from_single_file() method.

This also removes all keys with llm_adapter, which removes the warning about these keys not being used. In Diffusers, the AnimaTextConditioner is a separate part of the pipeline under text_conditioner, but all single file checkpoints contain both the transformer and llm_adapter tensors, which leads to the warning appearing.

I decided to add this extra change to my PR about the model.diffusion_model prefix because I felt the scope of the changes is rather trivial, but do let me know if I need to put it in a separate PR.

Fixes #14929

Before submitting

  • Did you use an AI agent (Claude Code, Codex, Cursor, etc.) to help with this PR? If so:
    • Did you read the Coding with AI agents guide?
    • Did you run the self-review skill on the diff?
    • Did you share the final self-review notes in the PR description or a comment?
  • Did you read the contributor guideline?
  • Did you read our philosophy doc? (important for complex PRs)
  • Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?
  • Are you the author (or part of the team) of the model/pipeline (only applicable for model/pipeline related PRs)?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@DN6

* 'main' of https://github.com/huggingface/diffusers: (327 commits)
  downcast MiniMax-H3 position_ids at the device transfer on fp64-less backends (huggingface#14767)
  Fix TaylorSeer cache crash when the feature shape changes between steps (huggingface#14831)
  [docs] Adapters (huggingface#14842)
  [LoRA] add LoRA training for Qwen Image 2.1 (huggingface#14808)
  Pin GitHub Actions to commit SHAs (huggingface#14853)
  Scope GITHUB_TOKEN permissions per job (huggingface#14852)
  test and docs for xet dedup based file sharing. (huggingface#14835)
  Add single file support for Qwen 2.1 (huggingface#14836)
  Fix Wuerstchen LoRA scheduler steps for distributed epochs (huggingface#14748)
  [docs] Fix legacy hf CLI references (diffusers) (huggingface#14830)
  [docs] Using diffusion pipelines (huggingface#14805)
  [docs] Fix docstring arguments that don't match the signatures (huggingface#14778)
  [docs] typo with hyperlink (huggingface#14826)
  Fix Ascend NPU RMSNorm and fused-attention mask shapes (huggingface#14288)
  [core] Fix component device placement for split-device pipelines (huggingface#14739)
  Fix flash/sage varlen prep under torch.compile with dynamic shapes (huggingface#14568)
  Synchronize the compute stream before offloading to disk (huggingface#14657)
  extend tests/others/test_cli_commands.py::TestRunCommand::test_group_… (huggingface#14697)
  Add SeaCache support for Cosmos3 pipelines (huggingface#14663)
  Add Qwen-Image 2.1 (huggingface#14804)
  ...
…` prefix instead of `.net` prefix, and remove unused `llm_adapter` keys

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CosmosTransformer3DModel.from_single_file() does not work with the model.diffusion_model. prefix

1 participant