nagadomi / nunif

Misc; latest version of waifu2x; 2D video to stereo 3D video conversion
MIT License
1.58k stars 142 forks source link

Error when running iw3——“PytorchStreamReader failed reading zip archive: failed finding central directory” #73

Closed yiyan32 closed 9 months ago

yiyan32 commented 9 months ago

image Strictly follow the steps to Manually install(https://github.com/nagadomi/nunif/blob/master/INSTALL-windows.md. The waifu2x is running well. However, when using iw3, whether it is converting pictures or videos, the same error will occur. The parameter settings are as shown above.

nagadomi commented 9 months ago

If waifu2x works, the iw3 model file may be corrupted due to download problems. Try deleting iw3/pretrained_models/hub folder and try again. The first run will download a 1GB+ file, so it may take a long time.

Also, CLI will provide more detailed error messages.

python -m iw3.cli -i input.jpg -o output.png
yiyan32 commented 9 months ago

I have downloaded all of the 3 depth models, still reporting an error. using the code you provided above for testing, the error details are as follows b00e1fa652b9234ceb02c566b8987f5

thank you for your time

nagadomi commented 9 months ago

The error is iw3/pretrained_models/hub/checkpoints/ZoeD_M12_N.pt file loading error. Pytorch checkpoint file(model/weight/parameter file, .pt,.pth) is internally a zip archive, so the file format error seems to be such a message.

Possible causes are,

  1. File is corrupt
  2. File path problems (e.g., multibyte characters, read permissions)
  3. Python or PyTorch version compatibility (pickle version)

It's not likely to be 2 or 3, as waifu2x(loading other checkpoint files) is working. Possible causes of file corruption,

Could you check the size and MD5 of iw3\pretrained_models\hub\checkpoints\ZoeD_M12_N.pt?

  1. check file size (on command prompt)

    dir iw3\pretrained_models\hub\checkpoints

    result

    
    Volume in drive C has no label.
    Volume Serial Number is EA34-A50B
    
    Directory of C:\dev\nunif\windows_package\nunif\iw3\pretrained_models\hub\checkpoints

09/27/2023 07:43 AM

. 09/27/2023 07:43 AM .. 09/27/2023 07:43 AM 1,443,406,099 ZoeD_M12_N.pt

2. check md5sum

certutil -hashfile iw3\pretrained_models\hub\checkpoints\ZoeD_M12_N.pt MD5

result

MD5 hash of iw3\pretrained_models\hub\checkpoints\ZoeD_M12_N.pt: f9b240db5a30a1600e25cad6866516b7 CertUtil: -hashfile command completed successfully.


File size: 1,443,406,099
MD5: f9b240db5a30a1600e25cad6866516b7

same result on linux.
```bash
% ls -la iw3/pretrained_models/hub/checkpoints/ZoeD_M12_N.pt
-rw------- 1 nagadomi nagadomi 1443406099  7月 28 13:02 iw3/pretrained_models/hub/checkpoints/ZoeD_M12_N.pt
% md5sum iw3/pretrained_models/hub/checkpoints/ZoeD_M12_N.pt
f9b240db5a30a1600e25cad6866516b7  iw3/pretrained_models/hub/checkpoints/ZoeD_M12_N.pt

Those ZoeDepth model files are downloaded from https://github.com/isl-org/ZoeDepth/releases/tag/v1.0

yiyan32 commented 9 months ago

It is indeed an error caused by the damaged model. After manually downloading the corresponding model from Huggingface, it can run smoothly. Thank you for your patience and guidance!

nagadomi commented 9 months ago

Do you have any idea why the file is damaged?

nagadomi commented 9 months ago

It seems that torch.hub.load stores the files first to the system's temporary folder. Possibly there is not enough space there.

I will add file validation with the hash value.

wangchuanzhang commented 9 months ago

Why is only the CPU recognized here and not my GPU? The CPU can be used, but it's too slow. 屏幕截图 2024-01-26 043910 屏幕截图 2024-01-26 043911

yiyan32 commented 9 months ago

image The above pic shows the model size and hash value that I downloaded automatically through the gui, while the system disk space is enough, it is very likely a network problem.

nagadomi commented 9 months ago

Thanks for the reply. It seems that there are repeated download failures, so automatic download retries may not fix the problem. However, I will try to clarify the error message.