keras-team / keras-core

A multi-backend implementation of the Keras API, with support for TensorFlow, JAX, and PyTorch.
Apache License 2.0
1.27k stars 115 forks source link

Error when running the model.fit on the wrapped model "Only input tensors may be passed as positional arguments." #951

Open ashkanee opened 3 months ago

ashkanee commented 3 months ago

When executing (it is the wrapped model):

model.fit(training_dataset, epochs=5) where training_dataset = tf.data.Dataset.from_tensor_slices((training_input, training_output.T))

I get:

RuntimeError: Exception encountered when calling ModelWrapper.call(). Could not automatically infer the output shape / dtype of 'model_wrapper' (of type ModelWrapper). Either theModelWrapper.call()method is incorrect, or you need to implement theModelWrapper.compute_output_spec() / compute_output_shape()method. Error encountered: Only input tensors may be passed as positional arguments. The following argument value should be passed as a keyword argument: None (of type <class 'NoneType'>) Arguments received by ModelWrapper.call(): • args=('<KerasTensor shape=(None,), dtype=float32, sparse=None, name=keras_tensor_10>',) • kwargs={'mask': 'None'}

Can you please help? Thanks