-
Hi, we tried training alpha_zero_torch on Backgammon (and some other games) and we ran into a libtorch error -- build open spiel from source ./build/examples/alpha_zero_torch_example --game=backgammon Full repo steps here: https://colab.research.google.com/drive/1D1L5PDSg0if6H2txuwbGYWxKQW5eQnIT#scrollTo=UDFmr_YVLifX The line that's breaking is full stack trace: https://etherpad.wikimedia.org/p/azas_os_trace When we run Long story short, it looks like what's happening is that the model set up by alpha_zero_torch uses the observation_tensor_shape of the game to set up the model config, see these lines: Thanks! UPDATE 6/28: We realized that in our setup, the command "./build/examples/alpha_zero_torch_example --game=backgammon --nn_model=mlp " doesn't give this error. So the error is specific to using the default resnet model (https://github.com/deepmind/open_spiel/blob/master/open_spiel/algorithms/alpha_zero_torch/model.cc#L274). --- details--- If we print out the output_config getting sent to libtorch (line 308 of model.cc: https://github.com/deepmind/open_spiel/blob/master/open_spiel/algorithms/alpha_zero_torch/model.cc#L308) while for backgammon it is: Notice that value_linear_in_features, policy_linear_in_features, value_observation_size, policy_observation_size are all zero and we think that's causing the "out of bounds for float" error in libtorch. They are 0 because the height and width variables are 0 here: We believe these are set here and here ObservationTensorShape() for backgammon is as follows and results in width getting set to 0: for comparison here is the same method for chess: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Oh sorry, I don't check this tab often and completely missed this. I am away now and will respond in a few days |
Beta Was this translation helpful? Give feedback.
-
Ah yes, this makes sense, I think, because the backgammon observation tensor is just a 1D vector, but I suspect the resnet model is expecting a 2D observation since it uses conv nets (explaining requiring 3 nonzero values in the observation shape). If you want to use a resnet, you will likely need to modify the observation tensor to be 2D. |
Beta Was this translation helpful? Give feedback.
Ah yes, this makes sense, I think, because the backgammon observation tensor is just a 1D vector, but I suspect the resnet model is expecting a 2D observation since it uses conv nets (explaining requiring 3 nonzero values in the observation shape).
If you want to use a resnet, you will likely need to modify the observation tensor to be 2D.