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

Can‘t run local demo, pickle.UnpicklingError: invalid load key, 'v'. #4

Open
emptystack1024 opened this issue Jul 10, 2024 · 5 comments

Comments

@emptystack1024
Copy link

我运行:
python app.py --pretrained_model_name_or_path /home/ubuntu/文档/GitHub/CharacterFactory/stable-diffusion-2-1

但是无法成功运行:
image

报错信息:
(IDEGAN) ubuntu@ubuntu-all-series:~/文档/GitHub/CharacterFactory$ python app.py --pretrained_model_name_or_path /home/ubuntu/文档/GitHub/CharacterFactory/stable-diffusion-2-1
Loading pipeline components...: 100%|█████████████| 6/6 [00:00<00:00, 7.01it/s]
[all_embeddings loaded] shape = torch.Size([326, 2, 1024]) max: tensor(0.0551, device='cuda:0') min={} tensor(-0.0558, device='cuda:0')
[name_emb_mean loaded] shape = torch.Size([2, 1024]) max: tensor(0.0167, device='cuda:0') min={} tensor(-0.0085, device='cuda:0')
now experiment_name: normal_GAN
[all_embeddings loaded] shape = torch.Size([226, 2, 1024]) max: tensor(0.0551, device='cuda:0') min={} tensor(-0.0558, device='cuda:0')
[name_emb_mean loaded] shape = torch.Size([2, 1024]) max: tensor(0.0187, device='cuda:0') min={} tensor(-0.0092, device='cuda:0')
now experiment_name: man_GAN
[all_embeddings loaded] shape = torch.Size([100, 2, 1024]) max: tensor(0.0527, device='cuda:0') min={} tensor(-0.0484, device='cuda:0')
[name_emb_mean loaded] shape = torch.Size([2, 1024]) max: tensor(0.0131, device='cuda:0') min={} tensor(-0.0100, device='cuda:0')
now experiment_name: woman_GAN
Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch().
experiment_name: man_GAN
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/gradio/queueing.py", line 541, in process_events
response = await route_utils.call_process_api(
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/gradio/route_utils.py", line 276, in call_process_api
output = await app.get_blocks().process_api(
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/gradio/blocks.py", line 1928, in process_api
result = await self.call_function(
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/gradio/blocks.py", line 1526, in call_function
prediction = await utils.async_iteration(iterator)
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/gradio/utils.py", line 657, in async_iteration
return await iterator.anext()
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/gradio/utils.py", line 650, in anext
return await anyio.to_thread.run_sync(
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
return await future
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 859, in run
result = context.run(func, *args)
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/gradio/utils.py", line 633, in run_sync_iterator_async
return next(iterator)
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/gradio/utils.py", line 816, in gen_wrapper
response = next(iterator)
File "app.py", line 198, in generate_image
Embedding_Manager.load(embedding_path)
File "/home/ubuntu/文档/GitHub/CharacterFactory/models/embedding_manager.py", line 126, in load
ckpt = torch.load(ckpt_path, map_location='cuda')
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/torch/serialization.py", line 815, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/home/ubuntu/anaconda3/envs/IDEGAN/lib/python3.8/site-packages/torch/serialization.py", line 1033, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.
^CKeyboard interruption in main thread... closing server.

@emptystack1024 emptystack1024 changed the title Can run local demo Can‘t run local demo, pickle.UnpicklingError: invalid load key, 'v'. Jul 10, 2024
@qinghew
Copy link
Owner

qinghew commented Jul 10, 2024

please check the embedding_path

@qinghew
Copy link
Owner

qinghew commented Jul 10, 2024

btw, if your path includes chinese word, it might cause some errors.

@emptystack1024
Copy link
Author

image
您好,抱歉刚看到,改了地址以后仍然会有报错,而且embedding_path在哪里呢?

@qinghew
Copy link
Owner

qinghew commented Jul 12, 2024

Our models are https://github.com/qinghew/CharacterFactory/tree/main/training_weight. please check that embedding_path loads the right path.

@qinghew
Copy link
Owner

qinghew commented Jul 12, 2024

you could also check our demo, and the code is https://huggingface.co/spaces/DecoderWQH666/CharacterFactory/blob/main/app.py.

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

2 participants