Fitting neural network does not work.

When attempting to fit an LSTM model to my data, I get the following error:

Error in py_call_impl(callable, dots$args, dots$keywords) : TypeError: 'NoneType' object is not callable

Here is my code:
model %>% fit(x_train, y_train, epochs = 50, batch_size=batch_size, verbose=1, shuffle=FALSE)

Funny thing is, defining and compiling the model works. I have also tried installing "reticulate" from github.

(Edit) Here is the full error message:
Error in py_call_impl(callable, dots$args, dots$keywords) : ValueError: in user code: /cloud/project/myenv/lib/python3.8/site-packages/tensorflow/python/keras/engine/ train_function * return step_function(self, iterator) /cloud/project/myenv/lib/python3.8/site-packages/tensorflow/python/keras/engine/ step_function ** outputs =, args=(data,)) /cloud/project/myenv/lib/python3.8/site-packages/tensorflow/python/distribute/ run return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs) /cloud/project/myenv/lib/python3.8/site-packages/tensorflow/python/distribute/ call_for_each_replica return self._call_for_each_replica(fn, args, kwargs) /cloud/project/myenv/lib/python3.8/site-packages/tensorflow/python/distribute/ _call_for_each_replica return fn(*args, **kwargs) /cloud/project/myenv/lib/python3.8/site-packages/tensorflow/pytho

I moved this from as it’s not an issue with R or Cloud.

The error message is one produced by python.

It is telling you that your function is expecting a callable object but is receiving None.

Here’s a nice general explanation of the source the the issue Python NoneType object is not callable (beginner) - Stack Overflow

I think a more complete reproducible example would be needed to help diagnose the issue.

Thanks @EconomiCurtis. I found that the solution was to just create a new project and run everything from scratch. Bit of a hassle, but it's better than nothing. I think the problem was that my LSTM (which is what I was using keras for) became a null object for some reason.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.