google / dopamine

Dopamine is a research framework for fast prototyping of reinforcement learning algorithms.
https://github.com/google/dopamine
Apache License 2.0
10.42k stars 1.36k forks source link

Cartpole example is not working in colab. #212

Open bwarre471 opened 10 months ago

bwarre471 commented 10 months ago

Cartpole example

https://colab.research.google.com/github/google/dopamine/blob/master/dopamine/colab/cartpole.ipynb

Is pretty much out of date...

Using it's code on C51, it throws this error on my local machine:

~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
RuntimeError: in user code:

    File "/home/arre/Code/Syncd/exchange_downloader/snek/.venv/lib/python3.11/site-packages/dopamine/discrete_domains/gym_lib.py", line 297, in call  *
        q_values = tf.reduce_sum(self.support * probabilities, axis=2)

    RuntimeError: x: Attempting to capture an EagerTensor without building a function.

  In call to configurable 'DQNAgent' (<class 'dopamine.agents.dqn.dqn_agent.DQNAgent'>)
  In call to configurable 'RainbowAgent' (<class 'dopamine.agents.rainbow.rainbow_agent.RainbowAgent'>)
  In call to configurable 'create_agent' (<function create_agent at 0x7f9841d527a0>)
  In call to configurable 'Runner' (<class 'dopamine.discrete_domains.run_experiment.Runner'>)
  In call to configurable 'TrainRunner' (<class 'dopamine.discrete_domains.run_experiment.TrainRunner'>)
  In call to configurable 'create_runner' (<function create_runner at 0x7f9841d3df80>)

On colab, I can't even get there, because there's an PIP version installed, and that doesn't works. Only github version works with DQN example, but C51 example is non-functional.