When running predict on Google Colab (to use TPU) the code crashes with the following error:
TPUEstimatorSpec.predictions must be dict of Tensors.
To solve it one can place the following code in _createmodel
predict = tf.argmax(probabilities, axis=-1)
predict_dict = {'predictions': predict} # this way it is not shot down by check in TPUEstimatorSpec
return loss, per_example_loss, logits, predict_dict
This of course also means changing the interpretation of the result
result = estimator.predict(input_fn=predict_input_fn)
result = list(result)
result = [pred['predictions'] for pred in result]
Currently I'm unable to to pull request since that would mean looking into whether it really is a solution. Just posting it here for anyone who has the same problem.
When running predict on Google Colab (to use TPU) the code crashes with the following error:
TPUEstimatorSpec.predictions must be dict of Tensors.
To solve it one can place the following code in _createmodel
This of course also means changing the interpretation of the result
Currently I'm unable to to pull request since that would mean looking into whether it really is a solution. Just posting it here for anyone who has the same problem.