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

When I run python gradio_PowerPaint.py, it looks for a .bin file in models/unet folder. But the model is a .safetensors file, changing the extension to .bin causes a pickle error. Any workaround?[Bug] #2089

Open
3 tasks done
alexbespik opened this issue Dec 13, 2023 · 1 comment
Assignees
Labels
kind/bug something isn't working

Comments

@alexbespik
Copy link

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmagic

Environment

virtualenv Linux manjaro kde

Reproduces the problem - code sample

Traceback (most recent call last):
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/gradio_PowerPaint.py", line 37, in
torch.load('./models/unet/diffusion_pytorch_model.bin'), strict=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/power/lib/python3.11/site-packages/torch/serialization.py", line 986, in load
with _open_file_like(f, 'rb') as opened_file:
^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/power/lib/python3.11/site-packages/torch/serialization.py", line 435, in _open_file_like
return _open_file(name_or_buffer, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/power/lib/python3.11/site-packages/torch/serialization.py", line 416, in init
super().init(open(name, mode))
^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './models/unet/diffusion_pytorch_model.bin'

Traceback (most recent call last):
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/gradio_PowerPaint.py", line 39, in
torch.load('./models/text_encoder/pytorch_model.bin'), strict=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/power/lib/python3.11/site-packages/torch/serialization.py", line 1028, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/power/lib/python3.11/site-packages/torch/serialization.py", line 1246, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.UnpicklingError: invalid load key, 'v'.

Reproduces the problem - command or script

python gradio_PowerPaint.py

Reproduces the problem - error message

Traceback (most recent call last):
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/gradio_PowerPaint.py", line 37, in
torch.load('./models/unet/diffusion_pytorch_model.bin'), strict=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/power/lib/python3.11/site-packages/torch/serialization.py", line 986, in load
with _open_file_like(f, 'rb') as opened_file:
^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/power/lib/python3.11/site-packages/torch/serialization.py", line 435, in _open_file_like
return _open_file(name_or_buffer, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/power/lib/python3.11/site-packages/torch/serialization.py", line 416, in init
super().init(open(name, mode))
^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './models/unet/diffusion_pytorch_model.bin'

Traceback (most recent call last):
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/gradio_PowerPaint.py", line 39, in
torch.load('./models/text_encoder/pytorch_model.bin'), strict=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/power/lib/python3.11/site-packages/torch/serialization.py", line 1028, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/run/media/alexbespik/e8df4068-7043-49ee-928b-ecb0cf9e68fb/mmagic/projects/powerpaint/power/lib/python3.11/site-packages/torch/serialization.py", line 1246, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.UnpicklingError: invalid load key, 'v'.

Additional information

all standard

@alexbespik alexbespik added the kind/bug something isn't working label Dec 13, 2023
@barepixels
Copy link

New user here. Want to report that I have the same problem "python gradio_PowerPaint.py, it looks for a .bin file in models/unet folder"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants