PWhiddy / PokemonRedExperiments

Playing Pokemon Red with Reinforcement Learning
MIT License
6.99k stars 644 forks source link

Can't run pretrained model v2 #192

Open IsraCode opened 2 weeks ago

IsraCode commented 2 weeks ago

i trained v2, and tried to run it with baseline/run_pretrained_interactive.py also tried reinstall numpy and cloudpickle

i got:

    baselines git:(master) ✗ python3 -m pip install numpy==1.25.0
    Collecting numpy==1.25.0
      Downloading numpy-1.25.0-cp311-cp311-macosx_11_0_arm64.whl.metadata (5.6 kB)
    Downloading numpy-1.25.0-cp311-cp311-macosx_11_0_arm64.whl (14.0 MB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.0/14.0 MB 2.5 MB/s eta 0:00:00
    Installing collected packages: numpy
      Attempting uninstall: numpy
        Found existing installation: numpy 2.1.3
        Uninstalling numpy-2.1.3:
          Successfully uninstalled numpy-2.1.3
    Successfully installed numpy-1.25.0
    ➜  baselines git:(master) ✗ python3 -m pip install --upgrade cloudpickle

    Requirement already satisfied: cloudpickle in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (2.2.1)
    Collecting cloudpickle
      Using cached cloudpickle-3.1.0-py3-none-any.whl.metadata (7.0 kB)
    Using cached cloudpickle-3.1.0-py3-none-any.whl (22 kB)
    Installing collected packages: cloudpickle
      Attempting uninstall: cloudpickle
        Found existing installation: cloudpickle 2.2.1
        Uninstalling cloudpickle-2.2.1:
          Successfully uninstalled cloudpickle-2.2.1
    Successfully installed cloudpickle-3.1.0
    ➜  baselines git:(master) ✗ python3 run_pretrained_interactive.py       
    UserWarning: Using SDL2 binaries from pysdl2-dll 2.28.0
    7331     pyboy.pyboy                    WARNING  The emulation speed might not be accurate when speed-target is higher than 5

    loading checkpoint
    Traceback (most recent call last):
      File "/Users/???/Programing/Fun/PokemonRedExperiments/baselines/run_pretrained_interactive.py", line 47, in <module>
        model = PPO.load(file_name, env=env, custom_objects={'lr_schedule': 0, 'clip_range': 0})
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/stable_baselines3/common/base_class.py", line 679, in load
        data, params, pytorch_variables = load_from_zip_file(
                                          ^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/stable_baselines3/common/save_util.py", line 421, in load_from_zip_file
        data = json_to_data(json_data, custom_objects=custom_objects)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/stable_baselines3/common/save_util.py", line 164, in json_to_data
        deserialized_object = cloudpickle.loads(base64_object)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ModuleNotFoundError: No module named 'numpy._core'
    7464     pyboy.pyboy                    INFO     ###########################
    7464     pyboy.pyboy                    INFO     # Emulator is turning off #
    7464     pyboy.pyboy                    INFO     ###########################
PWhiddy commented 3 days ago

Hi! It looks like you have an issue with your numpy installation. Is there a reason you manually installed 1.25.0? the 2.1.2 as listed in requirements.txt is what I used.