TypeError: CLIPTextModel.__init__() got an unexpected keyword argument 'offload_state_dict' · Issue #12436 · huggingface/diffusers · GitHub
Skip to content

TypeError: CLIPTextModel.__init__() got an unexpected keyword argument 'offload_state_dict' #12436

Closed

Description

@zillur01

Describe the bug

Getting this TypeError: CLIPTextModel.__init__() got an unexpected keyword argument 'offload_state_dict' when running a DiffusionPipeline.from_pretrained

Reproduction

I was following this https://huggingface.co/docs/diffusers/main/en/installation for installation. This is what I have done so far:

conda create -n diffusion python=3.10
conda activate diffusion
pip install diffusers["torch"] transformers

Then I tried to start a pipeline by running:

from diffusers import DiffusionPipeline
pipeline = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", use_safetensors=True)

Logs

>>> from diffusers import DiffusionPipeline
>>> pipeline = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", use_safetensors=True)
model_index.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 541/541 [00:00<00:00, 4.34MB/s]
scheduler_config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████| 308/308 [00:00<00:00, 3.30MB/s]
config.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 617/617 [00:00<00:00, 166kB/s]
preprocessor_config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 342/342 [00:00<00:00, 336kB/s]
special_tokens_map.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 472/472 [00:00<00:00, 378kB/s]
config.json: 4.72kB [00:00, 10.2MB/s]                                                                                                   | 1/15 [00:00<00:08,  1.65it/s]
merges.txt: 525kB [00:00, 5.92MB/s]
tokenizer_config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████| 806/806 [00:00<00:00, 5.94MB/s]
config.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 743/743 [00:00<00:00, 933kB/s]
config.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 547/547 [00:00<00:00, 310kB/s]
vocab.json: 1.06MB [00:00, 10.7MB/s]                                                                                                         | 0.00/547 [00:00<?, ?B/s]
safety_checker/model.safetensors: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 1.22G/1.22G [00:05<00:00, 233MB/s]
unet/diffusion_pytorch_model.safetensors: 100%|████████████████████████████████████████████████████████████████████████████████████| 3.44G/3.44G [00:06<00:00, 566MB/s]
vae/diffusion_pytorch_model.safetensors: 100%|██████████████████████████████████████████████████████████████████████████████████████| 335M/335M [00:06<00:00, 55.1MB/s]
text_encoder/model.safetensors: 100%|███████████████████████████████████████████████████████████████████████████████████████████████| 492M/492M [00:06<00:00, 73.1MB/s]
Fetching 15 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 15/15 [00:07<00:00,  2.03it/s]
Loading pipeline components...:  14%|██████████████▎                                                                                     | 1/7 [00:00<00:00, 18.78it/s]
Traceback (most recent call last):0%|████████████████████████████████████████████████████████████████████████████████████████████████| 492M/492M [00:06<00:00, 212MB/s]
  File "<stdin>", line 1, in <module>
  File "/home/zillur/miniconda3/envs/diffusion/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/zillur/miniconda3/envs/diffusion/lib/python3.10/site-packages/diffusers/pipelines/pipeline_utils.py", line 1025, in from_pretrained
    loaded_sub_model = load_sub_model(
  File "/home/zillur/miniconda3/envs/diffusion/lib/python3.10/site-packages/diffusers/pipelines/pipeline_loading_utils.py", line 849, in load_sub_model
    loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
  File "/home/zillur/miniconda3/envs/diffusion/lib/python3.10/site-packages/transformers/modeling_utils.py", line 277, in _wrapper
    return func(*args, **kwargs)
  File "/home/zillur/miniconda3/envs/diffusion/lib/python3.10/site-packages/transformers/modeling_utils.py", line 4974, in from_pretrained
    model = cls(config, *model_args, **model_kwargs)
TypeError: CLIPTextModel.__init__() got an unexpected keyword argument 'offload_state_dict'

System Info

Python version: 3.10.18
PyTorch version: 2.8.0
CUDA runtime: 12.8.90
huggingface-hub: 0.35.3
OS: Ubuntu 24.04.3 LTS
diffusers version: 0.35.1
transformers version: 4.57.0
accelerate version: 1.10.1

Who can help?

@sayakpaul @DN6

Activity

  1. zillur01 commented on Oct 6, 2025

    @zillur01
    Author

    downgraded transformers to 4.49 and diffusers to 0.32.2 and it's working now

  2. moha23 commented on Oct 6, 2025

    @moha23

    but doesnt the file require dev version of diffusers? for me it fails while running the file.. saying it needs dev version

  3. sayakpaul commented on Oct 6, 2025

    @sayakpaul
    Member

    We will take care of fixing the issue:

    TypeError: CLIPTextModel.__init__() got an unexpected keyword argument 'offload_state_dict'
    

    but doesnt the file require dev version of diffusers? for me it fails while running the file.. saying it needs dev version

    You can comment out the line that enforces that requirement for now.

  4. thuthaouelk10 commented on Oct 6, 2025

    @thuthaouelk10

    downgraded transformers to 4.49 and diffusers to 0.32.2 and it's working now

    I faced the same error when running a workflow using the node Hunyuan3D-Wrapper, I downgraded as you said and it works perfecty! Thank you so much!

  5. sayakpaul commented on Oct 6, 2025

    @sayakpaul
    Member

    Can you all check #12438?

  6. moha23 commented on Oct 6, 2025

    @moha23

    Can you all check #12438?

    works! thanks

  7. juanmartinez-fortis commented on Oct 6, 2025

    @juanmartinez-fortis

    Happening to all the models using CLIP Text, including Qwen Image Edit. And we can't downgrade to 0.32.2 as Qwen Image Edit is not there. Using the branch right now but this is super crafty

  8. baizhu0414 commented on Oct 6, 2025

    @baizhu0414

    I also encountered this problem, but what makes me uncomfortable is that my current script requires the version of diffusers:

    # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
    check_min_version("0.36.0.dev0")

    Does anyone have solusions?

  9. baizhu0414 commented on Oct 6, 2025

    @baizhu0414

    I also encountered this problem, but what makes me uncomfortable is that my current script requires the version of diffusers:

    Will error if the minimal version of diffusers is not installed. Remove at your own risks.

    check_min_version("0.36.0.dev0")
    Does anyone have solusions?

    #12436 (comment)
    this is the right method.

  10. asomoza commented on Oct 6, 2025

    @asomoza
    Member

    I'll revisit that training script, it's really old, both SD1.5 and SDXL are ancient technologies in the AI space, so those scripts are actually just fine by using older versions of all the libraries. We probably should pin the libraries to the latest working versions and remove the using from main line and comment in the instructions.

    Just to clarify:

    # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
    check_min_version("0.36.0.dev0")
    

    It is fine if you remove it and install older versions of diffusers, transformers and peft for scripts that haven’t been updated in a long time.

  11. sayakpaul commented on Oct 7, 2025

    @sayakpaul
    Member

    Please use #12438, for now.

    git clone https://github.com/huggingface/diffusers/
    cd diffusers
    pip uninstall -y diffusers
    pip install -e .
  12. sayakpaul commented on Oct 7, 2025

    @sayakpaul
    Member

    #12438 should fix it.

  13. sergioEl commented on Oct 7, 2025

    @sergioEl

    If anyone is facing the issue with Qwen-Image-Edit, here is working set up for me

    pip install diffusers["torch"]==0.35.1 transformers==4.56.2 accelerate==1.10.1

    my CUDA

    GPU is available. Using device: cuda
    PyTorch version: 2.8.0+cu128
    CUDA available: True
    CUDA version: 12.8
    GPU name: NVIDIA H100 80GB HBM3
  14. ingo-m commented on Oct 7, 2025

    @ingo-m

    Thanks. Pinning transformers==4.56.2 fixed it for me as well. (Looks like version 4.57.0 introduced the issue.)

  15. sayakpaul commented on Oct 8, 2025

    @sayakpaul
    Member

    #12438 should fix it and you don't have to downgrade transformers.

    Instructions:

    #12436 (comment)

  16. kevalmorabia97 commented on Oct 11, 2025

    @kevalmorabia97

    @sayakpaul when can we expect next release with this fix?

  17. siraxe commented on Nov 1, 2025

    @siraxe

    it was transformers for me as well pip install transformers==4.56.2 worked

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions