recommenders-team / recommenders

Best Practices on Recommendation Systems
https://recommenders-team.github.io/recommenders/intro.html
MIT License
18.71k stars 3.06k forks source link

[BUG] tensorflow-estimator is removed from tensorflow 2.16.1 #2072

Open SimonYansenZhao opened 5 months ago

SimonYansenZhao commented 5 months ago

Description

As mentioned in TensorFlow's release note for version 2.16.1, the breaking change that removes tensorflow-estimator is complete in TensorFlow 2.16.1. All code using TF estimator in Recommenders needs to change.

In which platform does it happen?

TensorFlow

How do we replicate the issue?

Expected behavior (i.e. solution)

Other Comments

daviddavo commented 3 weeks ago

This is needed to update to Python 3.12

I don't know anything about tensorflow and I'm having problems solving this issue. If someone can and wants to help, I did a mini-guide on the problem.

miguelgfierro commented 2 weeks ago

@daviddavo it would be good to know exactly what code is affected. Maybe there is a way to change these piece of code to change it. Also, we need to consider that we have some algos that we are going to change by a PyTorch version see https://github.com/recommenders-team/recommenders/issues/2111

daviddavo commented 2 weeks ago

Basically, the entirety of the wide_deep_utils.py file.

I haven't really used tensorflow, so I don't know exactly how it works, but this doesn't seem to be a minor change as it needs a complete refactoring to use tf.keras. For example, tf.estimator.RunConfig doesn't exist anymore and you need to create some callbacks: one for saving checkpoints, one for logging, etc. that may or may not be already available in the library. Each of the three models (wide, deep and wide-deep) would also need to be redone using tf.keras models.

The functions used by wide_deep but defined in tf_utils.py. There are some functions that would need to be created, and others that would be deleted:

Perhaps using keras 3 (backend agnostic) or Pytorch would take a similar effort to migrating to tf.keras.

miguelgfierro commented 2 weeks ago

If only wide and deep is affected, would it be easier to replace it with PyTorch? Here's an implementation: https://www.kaggle.com/code/matanivanov/wide-deep-learning-for-recsys-with-pytorch

I think TF W&D was done by @loomlike. What do you suggest?