Stability-AI / stablediffusion

High-Resolution Image Synthesis with Latent Diffusion Models
MIT License
38.83k stars 5.01k forks source link

Errors in txt2img.py and torch/serialization.py donno how to proceed! #250

Open y0ur5h4d0w opened 1 year ago

y0ur5h4d0w commented 1 year ago

hi all1 i've been thinkering the whole day in order to have the AI working on my ubuntu 23.04 laptop, right now i'm at the point where i get some errors i can't understand, these errors are the followings, is there anyone who can help me understand how to proceed? if you need any more informations just tell me!

OS: Ubuntu Linux 23.04 python version: 3.10.10 miniconda: latest, just downloaded

installed the requirements.txt already and got to the point you see down here ^^" thanks for the help!

(base) y05h@DarkLand:~/AI_STUFF/stablediffusion-main$ python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt /home/y05h/AI_STUFF/stable-diffusion-2-1/v2-1_768-ema-pruned.ckpt --config configs/stable-diffusion/v2-inference-v.yaml --H 768 --W 768
Global seed set to 42 Loading model from /home/y05h/AI_STUFF/stable-diffusion-2-1/v2-1_768-ema-pruned.ckpt Traceback (most recent call last): File "/home/y05h/AI_STUFF/stablediffusion-main/scripts/txt2img.py", line 389, in main (opt) File "/home/y05h/AI_STUFF/stablediffusion-main/scripts/txt2img.py", line 220, in main model = load_model_from_config(config, f"{opt.ckpt}", device) File "/home/y05h/AI_STUFF/stablediffusion-main/scripts/txt2img.py", line 31, in load_model_from_config pl_sd = torch.load(ckpt, map_location="cpu") File "/home/y05h/miniconda3/lib/python3.10/site-packages/torch/serialization.py", line 713, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/home/y05h/miniconda3/lib/python3.10/site-packages/torch/serialization.py", line 920, in _legacy_load magic_number = pickle_module.load(f, pickle_load_args) _pickle.UnpicklingError: invalid load key, 'v'.

drCJH commented 1 year ago

Check the checkpoint file: if you copied the url and used wget or similar, you end up with an html file (open in a text editor to check). You need to click the link and download the file through a web browser. It just seems to be a dumb huggingface thing.

Weigaa commented 7 months ago

@drCJH I met the same probelm, but i have downloaded the file through web browser, the same error occurs again.