harishanand95 / diffusers

AMD ONNX port of 🤗 Diffusers: State-of-the-art diffusion models
Apache License 2.0
58 stars 16 forks source link

PytorchStreamReader failed reading zip archive:failed finding central directory #11

Open MonsterMill opened 2 years ago

MonsterMill commented 2 years ago

Describe the bug

Hi,I'm following this video https://www.youtube.com/watch?v=Th-0oZjpDtk to deploy this diffuser on my AMD-GPU laptop,(python 3.10.8,Radeon 5600M),I started "save_onnx.py" and after it fetched 17 files,errors occurred(as reproduction) Is this mean that I need to change the model? (now using waifu-diffusion from hugging face) but, it also reports an UnicodeDecodeError mentioning that there exists an utf8 decode error. thanks a lot for any replies.

Reproduction

Traceback (most recent call last): File "F:\aihh\stable-diffusion-amd\diffusers-dml\src\diffusers\modeling_utils.py", line 71, in load_state_dict return torch.load(checkpoint_file, map_location="cpu") File "C:\Users\dell\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\serialization.py", line 705, in load with _open_zipfile_reader(opened_file) as opened_zipfile: File "C:\Users\dell\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\serialization.py", line 242, in init super(_open_zipfile_reader, self).init(torch._C.PyTorchFileReader(name_or_buffer)) RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "F:\aihh\stable-diffusion-amd\diffusers-dml\src\diffusers\modeling_utils.py", line 75, in load_state_dict if f.read().startswith("version"): UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 64: illegal multibyte sequence

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "F:\aihh\stable-diffusion-amd\diffusers-dml\examples\inference\save_onnx.py", line 16, in pipe = StableDiffusionPipeline.from_pretrained("hakurei/waifu-diffusion", scheduler=lms, use_auth_token=True) File "F:\aihh\stable-diffusion-amd\diffusers-dml\src\diffusers\pipeline_utils.py", line 248, in from_pretrained loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs) File "F:\aihh\stable-diffusion-amd\diffusers-dml\src\diffusers\modeling_utils.py", line 417, in from_pretrained state_dict = load_state_dict(model_file) File "F:\aihh\stable-diffusion-amd\diffusers-dml\src\diffusers\modeling_utils.py", line 87, in load_state_dict raise OSError( OSError: Unable to load weights from pytorch checkpoint file for 'C:\Users\dell/.cache\huggingface\diffusers\models--hakurei--waifu-diffusion\snapshots\cc452ee4c493761a0c5d6e92394729dbdcd2cb28\unet\diffusion_pytorch_model.bin' at 'C:\Users\dell/.cache\huggingface\diffusers\models--hakurei--waifu-diffusion\snapshots\cc452ee4c493761a0c5d6e92394729dbdcd2cb28\unet\diffusion_pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

Logs

No response

System Info

latest diffuser, python 3.10.8, AMD Radeon 5600M Graphics Card, Windows 11
YehorI commented 2 years ago

I have the same issue RX 5700XT ryzen 3600, python 3.10.6

Traceback (most recent call last): File "F:\SD\diffusers-dml\src\diffusers\modeling_utils.py", line 71, in load_state_dict return torch.load(checkpoint_file, map_location="cpu") File "F:\SD\diffenv\lib\site-packages\torch\serialization.py", line 777, in load with _open_zipfile_reader(opened_file) as opened_zipfile: File "F:\SD\diffenv\lib\site-packages\torch\serialization.py", line 282, in init super(_open_zipfile_reader, self).init(torch._C.PyTorchFileReader(name_or_buffer)) RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "F:\SD\diffusers-dml\src\diffusers\modeling_utils.py", line 75, in load_state_dict if f.read().startswith("version"): File "F:\SD\diffenv\lib\encodings\cp1251.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 2235: character maps to

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "F:\SD\diffusers-dml\examples\inference\save_onnx.py", line 16, in pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", scheduler=lms, use_auth_token=True) File "F:\SD\diffusers-dml\src\diffusers\pipeline_utils.py", line 248, in from_pretrained loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs) File "F:\SD\diffusers-dml\src\diffusers\modeling_utils.py", line 417, in from_pretrained state_dict = load_state_dict(model_file) File "F:\SD\diffusers-dml\src\diffusers\modeling_utils.py", line 87, in load_state_dict raise OSError( OSError: Unable to load weights from pytorch checkpoint file for 'C:\Users\Egor/.cache\huggingface\diffusers\models--CompVis--stable-diffusion-v1-4\snapshots\f15bc7606314c6fa957b4267bee417ee866c0b84\unet\diffusion_pytorch_model.bin' at 'C:\Users\Egor/.cache\huggingface\diffusers\models--CompVis--stable-diffusion-v1-4\snapshots\f15bc7606314c6fa957b4267bee417ee866c0b84\unet\diffusion_pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

YehorI commented 2 years ago

I redownload files and it fixed

MonsterMill commented 1 year ago

I redownload files and it fixed

thanks for the reply, I redownloaded it again and again and found it working on my vega 8 but not 5600M, it ran for seconds and my ram exploded(5600M‘s GPU-RAM does not have any occupation), seems that I can not choose which graphics card to run, poor AMD-GPU laptop : (