Skip to content

split "Latent Caching" into "Image Caching" and "Text Caching"#1462

Open
dxqb wants to merge 1 commit into
Nerogar:masterfrom
dxqb:cache-selection
Open

split "Latent Caching" into "Image Caching" and "Text Caching"#1462
dxqb wants to merge 1 commit into
Nerogar:masterfrom
dxqb:cache-selection

Conversation

@dxqb

@dxqb dxqb commented May 17, 2026

Copy link
Copy Markdown
Collaborator

with text caches becoming very large on recent models, you might want to disable text caching - but still do image caching
this PR splits this setting into two:
grafik

Rename `config.latent_caching` to `config.image_caching` and add a new
orthogonal `config.text_caching` field. Adds config migration 10 -> 11
mapping the old field to both new fields, preserving existing behavior.

This enables the previously-impossible (no image cache, yes text cache)
configuration. Updates modelSetup placement decisions (VAE/effnet ->
image_caching, text encoder -> text_caching), dataloader mixin gating,
trainer cache-clear/start-next-epoch logic, UI switches, and tracked
preset JSONs.
@dxqb dxqb added the preview merged in the preview branch label May 29, 2026
dxqb added a commit that referenced this pull request Jun 3, 2026
- BaseAnimaSetup: per-component checkpointing_or_offloading_enabled(),
  remove weight_list from create_autocast_context / disable_fp16_autocast_context
- AnimaFineTune/LoRASetup: latent_caching → image_caching / text_caching
- ModelType: add ANIMA to _MODEL_PARTS and supported_training_methods

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dxqb added a commit to TheForgotten69/OneTrainer that referenced this pull request Jun 3, 2026
dxqb added a commit that referenced this pull request Jun 4, 2026
@dxqb dxqb mentioned this pull request Jun 13, 2026
@dxqb

dxqb commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator Author

Claude: While testing the preview branch (which includes Ideogram #1522), found that modules/dataLoader/ErnieBaseDataLoader.py still uses config.latent_caching in two places (_preparation_modules and _output_modules, guarding prune_masked_tokens/pad_masked_tokens). This crashes with AttributeError: 'TrainConfig' object has no attribute 'latent_caching'.

Likely ErnieBaseDataLoader.py was added to master after this PR was branched, so it missed the latent_cachingimage_caching/text_caching split. Comparing with ZImageBaseDataLoader.py (which already uses config.text_caching for the equivalent pad_masked_tokens/prune_masked_tokens guards — same role: pruning/padding the text-encoder token cache), both Ernie occurrences should become config.text_caching.

dxqb added a commit that referenced this pull request Jun 14, 2026
# Conflicts:
#	modules/ui/TrainUI.py
#	modules/util/config/TrainConfig.py
dxqb added a commit that referenced this pull request Jun 14, 2026
Anima, Lens, and Ideogram setup files used the pre-#1476/#1462 4-arg
create_autocast_context/disable_fp16_autocast_context (with a weight-dtype
list), the old config.gradient_checkpointing.enabled() global check, and the
renamed config.latent_caching field. Update them to the current 3-arg
autocast helpers, per-part checkpointing via enable_checkpointing_for_*, and
config.image_caching/config.text_caching.
dxqb added a commit that referenced this pull request Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview merged in the preview branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant