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

Othello Keras Pretrained Model : UnpicklingError #278

Open
Dimanjan opened this issue Oct 2, 2022 · 0 comments
Open

Othello Keras Pretrained Model : UnpicklingError #278

Dimanjan opened this issue Oct 2, 2022 · 0 comments

Comments

@Dimanjan
Copy link

Dimanjan commented Oct 2, 2022

The pretrained model in https://github.com/suragnair/alpha-zero-general/tree/master/pretrained_models/othello/keras cannot be loaded.

Code:

import torch
model=torch.load("6x6 checkpoint_145.pth.tar",map_location='cpu')

Error Message:

---------------------------------------------------------------------------
UnpicklingError                           Traceback (most recent call last)
Cell In [2], line 2
      1 import torch
----> 2 model=torch.load("6x6 checkpoint_145.pth.tar",map_location='cpu')

File c:\Users\entdi\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\serialization.py:713, in load(f, map_location, pickle_module, **pickle_load_args)
    711             return torch.jit.load(opened_file)
    712         return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
--> 713 return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)

File c:\Users\entdi\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\serialization.py:920, in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
    914 if not hasattr(f, 'readinto') and (3, 8, 0) <= sys.version_info < (3, 8, 2):
    915     raise RuntimeError(
    916         "torch.load does not work with file-like objects that do not implement readinto on Python 3.8.0 and 3.8.1. "
    917         f"Received object of type \"{type(f)}\". Please update to Python 3.8.2 or newer to restore this "
    918         "functionality.")
--> 920 magic_number = pickle_module.load(f, **pickle_load_args)
    921 if magic_number != MAGIC_NUMBER:
    922     raise RuntimeError("Invalid magic number; corrupt file?")

UnpicklingError: invalid load key, 'H'.

The models in other folders can be loaded with similar code, but not this one.

Also, why is this a .pth.tar file instead of .h5 ?

Sorry, if this is a naive question.

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

1 participant