Unable to run this model. Loading always fails on a hugging face module: modeling_utils.py

#49
by ukaprch - opened

Message=load_checkpoint_and_dispatch() got an unexpected keyword argument 'strict'
Source=C:\Users\xxxxx\source\repos\AI\runtimes\bin\windows\Python38\Lib\site-packages\diffusers\models\modeling_utils.py
StackTrace:
File "C:\Users\xxxxx\source\repos\AI\runtimes\bin\windows\Python38\Lib\site-packages\diffusers\models\modeling_utils.py", line 774, in from_pretrained
accelerate.load_checkpoint_and_dispatch(
File "C:\Users\xxxxx\source\repos\AI\runtimes\bin\windows\Python38\Lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "C:\Users\xxxxx\source\repos\AI\runtimes\bin\windows\Python38\Lib\site-packages\diffusers\pipelines\pipeline_loading_utils.py", line 700, in load_sub_model
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
File "C:\Users\xxxxx\source\repos\AI\runtimes\bin\windows\Python38\Lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 876, in from_pretrained
loaded_sub_model = load_sub_model(
File "C:\Users\xxxxx\source\repos\AI\runtimes\bin\windows\Python38\Lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "C:\Users\xxxxx\source\repos\AI\modules\Inpaint-Anything\stable_diffusion_inpaint.py", line 358, in text_2_image_with_flux
pipe = FluxPipeline.from_pretrained(repo_id, torch_dtype=torch.bfloat16)
File "C:\Users\xxxxx\source\repos\AI\modules\Inpaint-Anything\app\app.py", line 165, in text_2_img_flux (Current frame)
text_2_img = text_2_image_with_flux(args.text_prompt, args.n_prompt, device=device)
File "C:\Users\xxxxx\source\repos\AI\runtimes\bin\windows\Python38\Lib\site-packages\gradio\utils.py", line 661, in wrapper
response = f(*args, **kwargs)
File "C:\Users\xxxxx\source\repos\AI\runtimes\bin\windows\Python38\Lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "C:\Users\xxxxx\source\repos\AI\runtimes\bin\windows\Python38\Lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\xxxxx\source\repos\AI\runtimes\bin\windows\Python38\Lib\threading.py", line 890, in _bootstrap
self._bootstrap_inner()
TypeError: load_checkpoint_and_dispatch() got an unexpected keyword argument 'strict'

spx621.jpg

Perhaps you need to update the accelerated package. They have added the strict keyword in April 2024. Ref: https://github.com/huggingface/accelerate/pull/2641

Thanks. This worked. Now I need to optimize as it runs very slow.

ukaprch changed discussion status to closed

Hello! ukaprch
I have the same issue, How can i fix this
thank you

Perhaps you need to update the accelerated package and any other packages that may be old.
pip install accelerate

Thank you
Much appreciated

Sign up or log in to comment