Skip to content

Add from_single_file support for Ideogram4Transformer2DModel#13933

Closed
HaozheZhang6 wants to merge 1 commit into
huggingface:mainfrom
HaozheZhang6:ideogram4-from-single-file
Closed

Add from_single_file support for Ideogram4Transformer2DModel#13933
HaozheZhang6 wants to merge 1 commit into
huggingface:mainfrom
HaozheZhang6:ideogram4-from-single-file

Conversation

@HaozheZhang6

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds from_single_file support for Ideogram4Transformer2DModel, so the community Ideogram 4 single-file / GGUF checkpoints load directly — e.g. leejet/ideogram-4-GGUF and stduhpf/ideogram-4-gguf, which are popular but currently can't be loaded in diffusers.

The single-file layout already matches diffusers except attention, which fuses the projection as attention.qkv and names the output projection attention.o. The conversion splits qkv into to_q/to_k/to_v and renames oto_out.0; every other key passes through unchanged.

import torch
from diffusers import Ideogram4Transformer2DModel, GGUFQuantizationConfig

transformer = Ideogram4Transformer2DModel.from_single_file(
    "https://huggingface.co/leejet/ideogram-4-GGUF/blob/main/ideogram4-Q4_0.gguf",
    config="ideogram-ai/ideogram-4-fp8",
    subfolder="transformer",
    quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
)

Checked on the Q4_0 GGUF: the converted state dict matches the model 1:1 (all keys and shapes), it loads through from_single_file and runs on a 16 GB GPU (~5.7 GB), and the split to_q/to_k/to_v line up with the official bf16 weights — cross-checked against the swapped splits to confirm the [q, k, v] order.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline?
  • Did you read our philosophy doc?
  • Was this discussed/approved via a GitHub issue or the forum? It's a small additive from_single_file registration, mirroring the existing converters (flux/chroma/cosmos/…).
  • Did you make sure to update the documentation with your changes? No doc change needed.
  • Did you write any new necessary tests? The Ideogram weights are gated, so a standard single-file integration test needs gated access in CI — happy to add one in whatever form you prefer; verification is in the description above.

Who can review?

@DN6 @sayakpaul

@HaozheZhang6

Copy link
Copy Markdown
Contributor Author

Folded this into #13942 since both add single_file support to the same two files. Easier to review as one. Closing here.

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

Labels

single-file size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant