Closed terrytangyuan closed 1 year ago
When rendering this example, I get an error after training for a few epochs. At first glance it looks like there is a tensor shape mismatch somewhere:
Quitting from lines 155-188 (timeseries_classification_transformer.qmd)
Error in py_call_impl(callable, dots$args, dots$keywords) :
TypeError: in user code:
<... omitted ...>mask)
File "/home/tomasz/.virtualenvs/r-tensorflow-website/lib/python3.10/site-packages/keras/utils/metrics_utils.py", line 77, in decorated
update_op = update_state_fn(*args, **kwargs)
File "/home/tomasz/.virtualenvs/r-tensorflow-website/lib/python3.10/site-packages/keras/metrics/base_metric.py", line 140, in update_state_fn
return ag_update_state(*args, **kwargs)
File "/home/tomasz/.virtualenvs/r-tensorflow-website/lib/python3.10/site-packages/keras/metrics/base_metric.py", line 691, in update_state **
matches = ag_fn(y_true, y_pred, **self._fn_kwargs)
File "/home/tomasz/.virtualenvs/r-tensorflow-website/lib/python3.10/site-packages/keras/metrics/metrics.py", line 3672, in sparse_categorical_accuracy
if matches.shape.ndims > 1 and matches.shape[-1] == 1:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
See `reticulate::py_last_error()` for details
Calls: .main ... evaluate.keras.engine.training.Model -> do.call -> <Anonymous> -> py_call_impl
Execution halted
Thank you!
Performance matches with https://keras.io/examples/timeseries/timeseries_classification_transformer/: