ranking icon indicating copy to clipboard operation
ranking copied to clipboard

Additional documentation of using TFR with keras API

Open mercarikaicheung opened this issue 3 years ago • 1 comments

Hi TFR team!

Really appreciating the new support for TFR with keras API, and the document here https://github.com/tensorflow/ranking/blob/master/tensorflow_ranking/examples/keras/README.md. I was wondering if there is method to use pre-trained embeddings with this API using hub? I was following the example to use feature_column with hub.embedding_column but there seem to be a disconnect as one expects string inputs and the data is in bytes since the data is in tfrecord format. You guys mentioned that we should shift away from feature_column, so I was wondering if there are examples without using the feature columns for TFR.

Thanks!

mercarikaicheung avatar Jun 24 '21 15:06 mercarikaicheung

In general, this should be doable. You could:

  1. Use the model to estimator pipeline as in example.
  2. Or inherit or make your own model_builder and override the create_inputs() function with something can create inputs from feature columns as in feature.create_keras_inputs.

I guess you may need some extra efforts to make things work smoothly. It would be more convenient for us to help debug if you could share a piece of code that you use hub.embedding_column to load or serve in your current working pipeline.

lyyanlely avatar Jul 13 '21 22:07 lyyanlely