kaesve / muzero

A clean implementation of MuZero and AlphaZero following the AlphaZero General framework. Train and Pit both algorithms against each other, and investigate reliability of learned MuZero MDP models.
MIT License
148 stars 24 forks source link

MountainCar encoder file doesn't exist #6

Closed frankbryce closed 3 years ago

frankbryce commented 3 years ago
python Main.py train -c Configurations/ModelConfigs/MuzeroMC.json  --game gym_MountainCar-v0 --gpu 1

The following command for me doesn't find the model files in MuZero/MuNeuralNet.py on line 242. On my machine the files are of the form /root/muzero/out/mc_out/latent_4/r_temp.pth.tar.data-00000-of-00001. Since you are using the encoder to load & save the file, perhaps use a try except block when loading the files to check for errors instead. This also doesn't break the encoder API... since it can save the file in whatever format it likes.

"it’s easier to ask for forgiveness than permission" - https://stackoverflow.com/questions/11360858/what-is-the-eafp-principle-in-python

joeryjoery commented 3 years ago

The problem you're experiencing is due to the newer versions of tensorflow and keras, in the newer versions they split up the model files into multiple smaller files. You can fix this by downgrading to the version explicitly stated in the README or update the IO interface.

frankbryce commented 3 years ago

Would you be amenable to a pull request to adjust the logic to be within a try ... except block, instead of preemptively checking? This would future proof it quite a bit.

joeryjoery commented 3 years ago

Thank you for the PR, I'll merge the changes after I unify this style for the other algorithms.

joeryjoery commented 3 years ago

Final comment, I changed the except blocks with except FileNotFoundError. The raised exceptions are intended to provide more context to which files are missing and should not catch any other errors.

frankbryce commented 3 years ago

Thank you! This is helpful to me, and anyone else like me that wants to use colab or other cloud tools to help me develop when I don't have a local GPU.