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

Unable to load weights for pytorch checkpoint file #52

Open
ElnuDev opened this issue Apr 18, 2023 · 1 comment
Open

Unable to load weights for pytorch checkpoint file #52

ElnuDev opened this issue Apr 18, 2023 · 1 comment

Comments

@ElnuDev
Copy link
Contributor

ElnuDev commented Apr 18, 2023

My main OS is NixOS, but I was having some issues getting the Python dependencies packaged, so I wanted to give mokuro a shot on Windows 10 first.

I have Python 3.9.13 installed (I checked and apparently PyTorch supports 3.10 now despite what the README says; I had the same issue in 3.10), and I have gone through the setup instructions. I have an Nvidia RTX 2060 SUPER, so I installed PyTorch with CUDA 11.7 per the instructions on PyTorch's website with pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117.

When I entered the directory with my scan image files and ran mokuro ., I got this error:

OSError: Unable to load weights from pytorch checkpoint file for 'C:\Users\elnu/.cache\huggingface\hub\models--kha-white--manga-ocr-base\snapshots\aa6573bd10b0d446cbf622e29c3e084914df9741\pytorch_model.bin' at 'C:\Users\elnu/.cache\huggingface\hub\models--kha-white--manga-ocr-base\snapshots\aa6573bd10b0d446cbf622e29c3e084914df9741\pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
2023-04-18 13:13:24.868 | INFO     | mokuro.run:run:51 - Processed successfully: 0/1

Full output here.

Any ideas what's gone wrong? Have I missed something? Thanks in advance.

Update: Just wanted to add that I was reading through Xelieu's guide and they mentioned that there sometimes is a problem where torch.cuda.is_available() may return False. I checked and for me this was the case, and even after reinstalling torch and verifying that it started detecting CUDA as available, I still ran into the same issue.

@kha-white
Copy link
Owner

Seems like something wrong with the model cache, you might try to delete the cache C:\Users\elnu/.cache\huggingface\hub\models--kha-white--manga-ocr-base and try again

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