kyleskom / NBA-Machine-Learning-Sports-Betting

NBA sports betting using machine learning
1.16k stars 431 forks source link

OSError: Cannot parse keras metadata at path Models/NN_Models/Trained-Model-ML-1680133120.689445\keras_metadata.pb: Received error: Error parsing message #344

Closed CesarCrZy closed 9 months ago

CesarCrZy commented 10 months ago

I get this error I have python version 3.11.0

sjx1943 commented 9 months ago

me too. Have you solved it?

CesarCrZy commented 9 months ago

yeah, i installed python 3.10.0 and pandas 2.1.0 and finally works

dcpatterson87 commented 9 months ago

@CesarCrZy @kyleskom I did this and still got the same error unfortunately

jsdanie1 commented 9 months ago

This is the same issue I'm having as well. Getting a handful of errors, this being one of them as well. (Oddly enough this works just fine on Google Colab, so not sure what the issue is in VS Code.

python3 - 3.11.7 (don't have much control of this i don't think, this one gets installed via the Microsoft Store) python - 3.10.0 per the suggestion i downgraded to this, didn't seem to make any difference.

Traceback (most recent call last):
  File "C:\Users\XXX\NBA-Machine-Learning-Sports-Betting\main.py", line 9, in <module>
    from src.Predict import NN_Runner, XGBoost_Runner
  File "C:\Users\XXX\NBA-Machine-Learning-Sports-Betting\src\Predict\NN_Runner.py", line 12, in <module>
    model = load_model('Models/NN_Models/Trained-Model-ML-1699315388.285516')
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\keras\src\saving\saving_api.py", line 262, in load_model
    return legacy_sm_saving_lib.load_model(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\keras\src\utils\traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "C:\Users\XXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\keras\src\saving\legacy\saved_model\load.py", line 113, in load
    raise IOError(
OSError: Cannot parse keras metadata at path Models/NN_Models/Trained-Model-ML-1699315388.285516\keras_metadata.pb: Received error: Error parsing message
dcpatterson87 commented 9 months ago

Are you able to get the web app running and train the model with updated data with Colab?

I can only get the very basic outputs to run in Colab. @jsdanie1

jsdanie1 commented 9 months ago

Nope I had trouble getting the Update and Train model to work in Colab, which is why I initially started to switch over to VS Code. So oddly enough, half of it works on Google, and half of it works on VS Code lol ( I might have to revsiit colab some more again). I can update the Get_Data in VS code just fine. just won't run the outputs. Alot of the commands i've experimented with switching them from python to python3 instead. some work that way and some don't. I can train the models, but cant get the output to run, and still having issues with flask (but not worried about that yet).

python3 -m Get_Data instead of python. This is like NPM and Yarn PTSD all over again lol

jsdanie1 commented 9 months ago

@dcpatterson87 appears to be the colab equlivant of getting data and training model to work.

# Create dataset with the latest data for 2023-24 season
%cd src/Process-Data
!python -m Get_Data
!python -m Get_Odds_Data
!python -m Create_Games

# Train models
%cd ../Train-Models
!python -m XGBoost_Model_ML
!python -m XGBoost_Model_UO
eSpadaMaddyS commented 8 months ago

@jsdanie1 Did you solve this problem?Same error with keras_metadata. I use Python 3.10,Windows

jsdanie1 commented 8 months ago

@jsdanie1 Did you solve this problem?Same error with keras_metadata. I use Python 3.10,Windows

I gave up on the windows. Spent way too much time and just wasn't getting anywhere. I don't know much Python to begin with to really troubleshoot or update code areas that are probable starting to get depreciated now. But works fine in Colab if you're just wanting to see how it works.

waynesid commented 8 months ago

@jsdanie1 got this error in Windows, Vscode : raise IOError( OSError: No file or directory found at Models/NN_Models/Trained-Model-ML-1680133120.689445 My solution: Created a new Virtual environment for the project run pip freeze > requirements.txt to install all libraries to the venv created a new nn model in Train-Models folder, python -m NN_Model_ML.py
replaced the model path in the NN_Runner.py run python main.py -nn -odds=fanduel