tensorflow / ranking

Learning to Rank in TensorFlow
Apache License 2.0
2.74k stars 475 forks source link

UserWarning: Input dict contained keys [...] which did not match any model input. They will be ignored by the model. #269

Closed azagniotov closed 3 years ago

azagniotov commented 3 years ago

I am am using the following example to train a model using a toy data (I can provide ELWC structure if needed): https://github.com/tensorflow/ranking/blob/master/tensorflow_ranking/examples/keras/keras_m2e_tfrecord.py

on the following TF stack:

During training I see the following warning about a missing key starsand and I do not know if this is a warning I should worry about. The stars is the name of my label feature in ELWC

INFO:tensorflow:Calling model_fn.
/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/tensorflow/python/keras/engine/functional.py:591: UserWarning: Input dict contained keys ['stars'] which did not match any model input. They will be ignored by the model.
  [n for n in tensors.keys() if n not in ref_input_names])
INFO:tensorflow:Done calling model_fn.

Could you please advise?

xuanhuiwang commented 3 years ago

This doesn't affect the training. You can pop the feature stars from the input features when constructing the labels.

azagniotov commented 3 years ago

@xuanhuiwang thank you. Right, but the label is already being poped in the following code as per the aforementioned example:

features = tf.compat.v1.data.make_one_shot_iterator(dataset).get_next()
label = tf.squeeze(features.pop(_LABEL_FEATURE), axis=2)
label = tf.cast(label, tf.float32)

but, thank you again for confirming about the training,