Skip to content

Transformers fix#1526

Closed
Artheriax wants to merge 1 commit into
Nerogar:previewfrom
Artheriax:preview
Closed

Transformers fix#1526
Artheriax wants to merge 1 commit into
Nerogar:previewfrom
Artheriax:preview

Conversation

@Artheriax

@Artheriax Artheriax commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Fix AttributeError: 'CLIPTextModel' object has no attribute 'text_model' caused by
transformers >= 5.9 restructuring CLIPTextModel internals.

In newer transformers releases, embeddings, encoder, and final_layer_norm moved
from a nested text_model submodule directly onto CLIPTextModel.
CLIPTextModelWithProjection is unaffected — it still wraps an inner CLIPTextModel
via .text_model.

9 files changed (9 edits):

  • modules/modelSetup/BaseStableDiffusionSetup.py.text_model.embeddings.embeddings
  • modules/modelSetup/BaseStableDiffusionXLSetup.py.text_model.embeddings.embeddings (te1 only)
  • modules/modelSetup/BaseFluxSetup.py.text_model.embeddings.embeddings (te1 only)
  • modules/modelSetup/BaseHunyuanVideoSetup.py.text_model.embeddings.embeddings (te2 only)
  • modules/modelSetup/BaseWuerstchenSetup.py.text_model.embeddings.embeddings (prior)
  • modules/modelLoader/stableDiffusionXL/StableDiffusionXLModelLoader.py.text_model.embeddings.embeddings (ckpt path)
  • modules/model/WuerstchenModel.py.text_model.final_layer_norm.final_layer_norm
  • modules/modelSampler/WuerstchenSampler.py.text_model.final_layer_norm.final_layer_norm
  • modules/model/util/clip_util.py — added hasattr(text_encoder, 'text_model') guard

Test plan

  • pre-commit run --all-files passes
  • Launched the affected UI or script and exercised the change
  • Tested with at least one real preset / config when relevant (note which: SDXL lora)

AI assistance

  • AI-assisted to find the cause of the bug.

This broke training fully when trying to start it.
@dxqb

dxqb commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

if you use the preview branch, please mention it. The preview branch is known to be broken for SDXL or any model that uses CLIP.
This fix is not sufficient. The entire scope you can find here: #1506

@dxqb dxqb closed this Jun 15, 2026
@O-J1 O-J1 added the invalid This doesn't seem right label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants