visual-chatgpt icon indicating copy to clipboard operation
visual-chatgpt copied to clipboard

OSError: Unable to load weights from pytorch checkpoint file

Open magedhelmy1 opened this issue 2 years ago • 3 comments

When executing python visual_chatgpt.py the second time, it returns the following error.

OSError: Unable to load weights from pytorch checkpoint file for 
'/home/usr/.cache/huggingface/hub/models--runwayml--stable-diffusion-inpainting/snapshots/caac1048f28756b68
042add4670bec6f4ae314f8/safety_checker/pytorch_model.bin' at 
'/home/usr/.cache/huggingface/hub/models--runwayml--stable-diffusion-inpainting/snapshots/caac1048f28756b68
042add4670bec6f4ae314f8/safety_checker/pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0
checkpoint, please set from_tf=True.

The only way I could deal with this is to delete the whole huggingface .cache folder and redownload again. Does anyone have a better solution?

Thank you

magedhelmy1 avatar Mar 11 '23 20:03 magedhelmy1

Hi, actually you can just download the needed model ckp again and specify your ckp path when loading ckp with from_pretrained() method.

ZetangForward avatar Mar 12 '23 00:03 ZetangForward

@magedhelmy1 Have you ever check whether there is a pytorch_model.bin in your hugging face .cache folder? If there was not any model files you need, just download it again, and if there was, just find another source of the error

K-tang-mkv avatar Mar 12 '23 00:03 K-tang-mkv

Maybe ur download failed and the file is incomplete, add the .no_exist folder to models--runwayml--stable-diffusion-inpainting and delete the wrong subfolder, then try again.

jsionr avatar Mar 13 '23 05:03 jsionr

what's the url to down the pytorch_model.bin

@magedhelmy1 Have you ever check whether there is a pytorch_model.bin in your hugging face .cache folder? If there was not any model files you need, just download it again, and if there was, just find another source of the error

chat1q2w3e4r5t avatar Apr 04 '23 12:04 chat1q2w3e4r5t