Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: load_checkpoint_and_dispatch() got an unexpected keyword argument 'strict' #134

Open
CODERConfused opened this issue Aug 31, 2024 · 3 comments

Comments

@CODERConfused
Copy link

```model_id = "black-forest-labs/FLUX.1-schnell" # you can also use `black-forest-labs/FLUX.1-dev

pipe = FluxPipeline.from_pretrained(
"black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16
)
#pipe.enable_model_cpu_offload() # save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power

prompt = "A cat holding a sign that says hello world"
seed = 42
image = pipe(
prompt,
output_type="pil",
num_inference_steps=4, # use a larger number if you are using [dev]
generator=torch.Generator("cpu").manual_seed(seed),
).images[0]
image.save("flux-schnell.png")```

When I try to run this code, this error appears:

Loading pipeline components...:  86%
 6/7 [00:01<00:00,  4.05it/s]
You set add_prefix_space. The tokenizer needs to be converted from the slow tokenizers
Loading checkpoint shards: 100%
 2/2 [00:00<00:00,  3.75it/s]

TypeError Traceback (most recent call last)
Cell In[2], line 3
1 model_id = "black-forest-labs/FLUX.1-schnell" # you can also use black-forest-labs/FLUX.1-dev
----> 3 pipe = FluxPipeline.from_pretrained(
4 "black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16
5 )
6 #pipe.enable_model_cpu_offload() # save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
8 prompt = "A cat holding a sign that says hello world"

File c:\Users\Home7\AppData\Local\Programs\Python\Python312\Lib\site-packages\huggingface_hub\utils_validators.py:114, in validate_hf_hub_args.._inner_fn(*args, **kwargs)
111 if check_use_auth_token:
112 kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.name, has_token=has_token, kwargs=kwargs)
--> 114 return fn(*args, **kwargs)

File c:\Users\Home7\AppData\Local\Programs\Python\Python312\Lib\site-packages\diffusers\pipelines\pipeline_utils.py:859, in DiffusionPipeline.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
856 loaded_sub_model = passed_class_obj[name]
857 else:
858 # load sub model
--> 859 loaded_sub_model = load_sub_model(
860 library_name=library_name,
861 class_name=class_name,
862 importable_classes=importable_classes,
863 pipelines=pipelines,
864 is_pipeline_module=is_pipeline_module,
...
792 # names to the new non-deprecated names. Then we greatly encourage the user to convert
793 # the weights so we don't have to do this again.
795 if "'Attention' object has no attribute" in str(e):

TypeError: load_checkpoint_and_dispatch() got an unexpected keyword argument 'strict'

Can you please help? Thank you in advance.

@henbucuoshanghai
Copy link

load_checkpoint_and_dispatch() got an unexpected keyword argument 'strict'
same error

@Qjrun
Copy link

Qjrun commented Sep 4, 2024

pip install accelerate -U

@iamargentum
Copy link

thanks @Qjrun ! this totally worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants