kaesve/muzero

MountainCar encoder file doesn't exist

Closed this issue · 5 comments

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

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.

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.

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

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.

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.