tensorflow / recommenders

TensorFlow Recommenders is a library for building recommender system models using TensorFlow.
Apache License 2.0
1.85k stars 277 forks source link

Various warnings in model from tutorial example. #188

Open ydennisy opened 3 years ago

ydennisy commented 3 years ago

Hi!

First big thanks on this project - seems very nice so far!

Just a quick one, I am seeing 3 warning when following the examples from the tutorials, they do not seem to affect the model in any obvious way, but I think it would be good to get them fixed up:

1. Layers in a Sequential model should only have a single input tensor

WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'dict'> input: {'url': <tf.Tensor 'IteratorGetNext:2' shape=(None,) dtype=string>, 'text': <tf.Tensor 'IteratorGetNext:1' shape=(None,) dtype=string>}
Consider rewriting this model with the Functional API

2. dtype of the source tensor

WARNING:tensorflow:The dtype of the source tensor must be floating (e.g. tf.float32) when calling GradientTape.gradient, got tf.int32

3. Gradients do not exist for variables

WARNING:tensorflow:Gradients do not exist for variables ['counter:0'] when minimizing the loss.

If I get to the bottom of any of these issues I will be sure to report / PR.

Cheers!

maciejkula commented 3 years ago

1 can be safely ignored: in general, Keras encourages its users to use functional models for multi-input layers, but there is nothing wrong with doing so.

I'll have a PR that may help with (2) and (3). I'll ping this thread when merged.