hsahovic / poke-env

A python interface for training Reinforcement Learning bots to battle on pokemon showdown
https://poke-env.readthedocs.io/
MIT License
299 stars 105 forks source link

Problem running examples examples/rl_with_new_open_ai_gym_wrapper.py or examples/rl_with_open_ai_gym_wrapper.py #563

Open MarcoGonzalezM opened 5 months ago

MarcoGonzalezM commented 5 months ago

I have been trying to run the examples for RL Players several times with no luck. The Issue seems to be a problem with the requirements because the errors are usually an ImportError (I'll add pictures of the ones I have found). I have tried with different Python versions (from 3.8 to 3.11) and diferent Tensorflow versions (from 2.13 to 2.16), also switching between keras-rl and keras-rl2, but none of the combinations I have tried works. Not sure if this is a problem in the source of the examples or I misunderstood the dependencies. image image

rahul-dev-app commented 4 months ago

I might be able to help with this one! I installed poke-env and installed keras-rl2. I have python-3.12 and tensorflow-2.17. I am also using a virtualenvwrapper for my python environment.

cannot import model_from_config is a change in tensorflow-2.15 check this link.

To tackle that I went into the .virtualenv folder and removed the model_from_config from imports. If tensorflow is imported, for example, as tf; I replaced all instances of model_from_config to tf.keras.models.model_from_config and that did the job for me.

Now I know that this change is post tensorflow version 2.15 and holding to an older version should've solved the problem; it did not work for me and I had to change a bunch of stuff. The method I followed seemed neater.

rahul-dev-app commented 4 months ago

Hi, never mind; I only got so far with the changes and ultimately the examples did not work. I think that's because keras-rl stopped working. See https://github.com/hsahovic/poke-env/issues/483#issuecomment-1892915806