huggingface / huggingface/diffusers
[Version 0.39.0]AttributeError: 'CLIPTextModel' object has no attribute 'text_model' WHEN SET CKIP_SKIP NOT NONE
Open
Nobody has claimed this yet.
bug
pipelines
- Dominant language
- Python
- Stars
- 34.5k
- Forks
- 7.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 91
Description
Describe the bug
This bug should have been fixed, yet it still occurs in the latest version.
It does not trigger when clip_skip is set to None, but the issue appears whenever clip_skip has a non-None value.
Reproduction
pipe = StableDiffusionPipeline.from_single_file(
pretrained_model_link_or_path=model_path,
torch_dtype=torch.float16 if device.type == "cuda" else torch.float32,
use_safetensors=True,
)
results = pipeline(
prompt=[prompt] * batch,
negative_prompt=[negative_prompt] * batch,
height=height,
width=width,
num_inference_steps=steps,
guidance_scale=guidance_scale,
generator=generators,
clip_skip=clip_skip
)
Logs
- error log
File "D:\Python\python_3_14\Lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_stable_diffusion.py", line 962, in __call__
prompt_embeds, negative_prompt_embeds = self.encode_prompt(
~~~~~~~~~~~~~~~~~~^
prompt,
^^^^^^^
...<7 lines>...
clip_skip=self.clip_skip,
^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "D:\Python\python_3_14\Lib\site-packages\diffusers\pipelines\stable_diffusion\pipeline_stable_diffusion.py", line 437, in encode_prompt
prompt_embeds = self.text_encoder.text_model.final_layer_norm(prompt_embeds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\python_3_14\Lib\site-packages\torch\nn\modules\module.py", line 1965, in __getattr__
raise AttributeError(
f"'{type(self).__name__}' object has no attribute '{name}'"
)
AttributeError: 'CLIPTextModel' object has no attribute 'text_model'
System Info
- Software Version
diffusers 0.39.0
transformers 5.13.0
Who can help?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pipeline_stable_diffusion.py at StableDiffusionPipeline.encode_prompt, around the reported line 437, and reproduce the failure with clip_skip set to a non-None value. Compare that path with clip_skip=None and verify that the pipeline completes without the reported CLIPTextModel AttributeError for the listed diffusers and transformers versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100