huggingface / huggingface/diffusers
`from_single_file()` support missing/incomplete for Ideogram4 and Krea2 transformers
- Dominant language
- Python
- Stars
- 34.5k
- Forks
- 7.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 91
Description
### Describe the bug
Neither `Ideogram4Transformer2DModel` nor `Krea2Transformer2DModel` currently support `from_single_file()`, though
for different reasons.
**Ideogram4Transformer2DModel** inherits `FromOriginalModelMixin` (since it was added in #13859), but it was never
added to `SINGLE_FILE_LOADABLE_CLASSES` in `src/diffusers/loaders/single_file_model.py`, and no
`convert_ideogram4_transformer_checkpoint_to_diffusers`-style mapping function exists in `single_file_utils.py`.
Calling `from_single_file()` on it currently raises unconditionally, since
`_get_single_file_loadable_mapping_class()` can only match classes that are registered in
`SINGLE_FILE_LOADABLE_CLASSES`:
For comparison, other recently added transformers (Cosmos, Flux2, ZImage, ...) both inherit the mixin *and* have a
`checkpoint_mapping_fn` registered.
**Krea2Transformer2DModel** doesn't inherit `FromOriginalModelMixin` at all, so `from_single_file` isn't even
defined on the class. This looks like it may simply be because there's no public checkpoint (original or
diffusers-format) to convert from yet — the docs mention loading "from a local directory produced by the Krea 2
Drafted by Claude, but confirmed, except the internals above
### Reproduction
```python
from diffusers import Ideogram4Transformer2DModel
Ideogram4Transformer2DModel.from_single_file("some/checkpoint.safetensors")
# ValueError: ...
```
### Logs
```shell
```
### System Info
cbdb63798bc627e35ca6656265b7185e7618ad92
### Who can help?
Questions on single file checkpoints: @DN6
Contributor guide
Research direction
Start in src/diffusers/loaders/single_file_model.py and src/diffusers/loaders/single_file_utils.py, comparing the Cosmos, Flux2, and ZImage registrations and mapping functions. Reproduce the Ideogram4 failure, then inspect Krea2Transformer2DModel and its loading documentation to establish the intended scope. Done means Ideogram4 has the required single-file registration and mapping, and Krea2 support is resolved or its prerequisite is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100