agents icon indicating copy to clipboard operation
agents copied to clipboard

Failed to run the Train_eval_atari.py in categorical DQN example

Open okvlam opened this issue 4 years ago • 2 comments

I have been trying to run the example by following,

python tf_agents/agents/categorical_dqn/examples/train_eval_atari.py \
 --root_dir=$HOME/atari/pong \
  --alsologtostderr

However, this error occurs...

W tensorflow/core/kernels/data/generator_dataset_op.cc:107] Error occurred when finalizing GeneratorDataset iterator: Failed precondition: Python interpreter state is not initialized. The process may be terminated.
         [[{{node PyFunc}}]]

Any suggestion to run the example successfully?

okvlam avatar Jan 27 '21 14:01 okvlam

I have reproduced this error in my local environment as:

python tf_agents/agents/categorical_dqn/examples/train_eval_atari.py --root_dir=/tmp/atari/pong --alsologtostderr

tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[31] = [31, 140186793017576] does not index into param shape [32,6,51] [Op:GatherNd] In call to configurable 'TrainEval' (<class 'main.TrainEval'>) 2021-01-29 11:23:32.072110: W tensorflow/core/kernels/data/generator_dataset_op.cc:107] Error occurred when finalizing GeneratorDataset iterator: Failed precondition: Python interpreter state is not initialized. The process may be terminated. [[{{node PyFunc}}]]

Add log message in line 426 of categorical_dqn_agent output as:

I0129 11:23:31.759348 140201841637120 categorical_dqn_agent.py:426] q_logits [32 6 51] indices [32] actions [32] [ 0 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576 140186793017576] reshape actions [32 2]

The value in the actions array, which is produced from input experience, are out of the bounds of the second dimension of q_logits

king821221 avatar Jan 29 '21 03:01 king821221

Has anyone on the TF-Agents team ever thought of putting together a colab tutorial on how to run Atari games? This seems to be a real weak spot for TF-Agents. Most of your competitors have such easy/friendly examples.

jeffheaton avatar Jun 22 '21 14:06 jeffheaton