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

Pre-trained Models Do Not Work #14

Open
WilliamYue37 opened this issue Sep 12, 2023 · 7 comments
Open

Pre-trained Models Do Not Work #14

WilliamYue37 opened this issue Sep 12, 2023 · 7 comments

Comments

@WilliamYue37
Copy link

When I run python enjoy.py --model=./models/mortar_mayhem_grid.nn, I get this python pickle error:

pygame 2.5.1 (SDL 2.28.2, Python 3.7.16)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "enjoy.py", line 71, in <module>
    main()
  File "enjoy.py", line 26, in main
    state_dict, config = pickle.load(open(model_path, "rb"))
_pickle.UnpicklingError: invalid load key, 'v'.

I followed the installation steps listed in the README for CUDA. The commands I ran were:

conda create -n recurrent-ppo python=3.7 --yes
conda activate recurrent-ppo
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.6 -c pytorch -c conda-forge
git clone https://github.com/MarcoMeter/recurrent-ppo-truncated-bptt.git
cd recurrent-ppo-truncated-bptt
pip install -r requirements.txt
python enjoy.py --model=./models/mortar_mayhem_grid.nn

I am running these commands on Ubuntu 20.04.6.

Could you please look into this? Thanks!

@MarcoMeter
Copy link
Owner

MarcoMeter commented Sep 12, 2023

Hi @WilliamYue37
I was not able to reproduce your issue. I'm wondering whether your model file is corrupted.
Try to download it again using this link
mortar_mayhem_grid.nn
Does this happen to all pretrained models? I just tried them all without encountering any issues.

By the way, I just updated the installation instructions. Python 3.7 is outdated for Memory Gym version 1.0.0. The recommended Python version is 3.11 by now.

@WilliamYue37
Copy link
Author

The model in the download link you sent works. When I run diff mortar_mayhem_grid.nn models/mortar_mayhem_grid.nn, I get that Binary files mortar_mayhem_grid.nn and models/mortar_mayhem_grid.nn differ where mortar_mayhem_grid.nn is the pretrained model from the download link you sent. I think the model file in the Github repo is corrupted since I tried cloning the repository again and the same python pickle issues occurred. I also tried following your new installation instructions on a M2 Macbook Air running macOS Ventura 13.5.2 and the same issue python pickle issue occurred. The issue happens to all pretrained models included in the repository.

@MarcoMeter
Copy link
Owner

Thanks for the insights. I deleted and readded the pretrained models. Hope this helps.

@WilliamYue37
Copy link
Author

I tried cloning again and I still get a python pickle issue. I'll close the issue now since I'm not sure if it's an issue on my side or your side. In any case, I can just use the download link you sent. Thanks for looking into this!

@MarcoMeter
Copy link
Owner

I downloaded the zip of this repo and was able to reproduce this issue. Not sure yet how to fix this soon. Lets keep this open so that others notice this issue.

@MarcoMeter MarcoMeter reopened this Sep 12, 2023
@Johnny1188
Copy link

Hi, I encountered the same issue and resolved it by doing the following:

  1. Removing the repository
  2. Installing git-lfs within the active Anaconda environment: conda install -c conda-forge git-lfs
  3. Running git lfs install
  4. Cloning the repository again

@MarcoMeter
Copy link
Owner

Thanks for approaching this. I'll probably go for a the huggingface hub for distributing pre-trained models. Just like how I did that for my CleanRL implementation on PPO-Transformer-XL.

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

3 participants