Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mechanically replace Model.*_generator with Model.* in Python files #1064

Merged
merged 2 commits into from
Mar 12, 2020

Conversation

huonw
Copy link
Member

@huonw huonw commented Mar 11, 2020

Tensorflow Keras's Model type has deprecated its ..._generator methods in Tensorflow 2.1.0.

https://www.tensorflow.org/api_docs/python/tf/keras/Model#fit_generator:

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Please use Model.fit, which supports generators.

https://github.com/tensorflow/tensorflow/releases/tag/v2.1.0-rc1:

Model.fit_generator, Model.evaluate_generator, and Model.predict_generator are deprecated endpoints. They are subsumed by Model.fit, Model.evaluate, and Model.predict which now support generators and Sequences.

This patch does an automatic replacement of the following, in *.py files:

  • fit_generatorfit
  • predict_generatorpredict
  • evaluate_generatorevaluate

It does not make any changes to ensemble.py/test_ensemble.py (#1065), because we define our own fit_generator (etc.) methods there, and thus manual work is required. Nor does it do any of the notebooks (#1066), in order to break the work up and reduce merge conflicts (notebooks are more likely to have merge conflicts, and they're more annoying to resolve).

There's a few places where manual changes might be good (e.g. mistakes in comments), but I'd prefer not to do them here: keeping this fully automated makes it easy to resolve any merge conflicts (revert the file to the other form, and then redo the automated replacement). As you review, feel free to do some manual changes as your own separate branch/PR.

See: #803

@codeclimate
Copy link

codeclimate bot commented Mar 11, 2020

Code Climate has analyzed commit 82f9d7d and detected 0 issues on this pull request.

View more on Code Climate.

@huonw huonw requested review from kieranricardo and kjun9 March 11, 2020 22:58
@huonw huonw marked this pull request as ready for review March 11, 2020 22:58
Copy link
Contributor

@kjun9 kjun9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@huonw huonw merged commit 3584f66 into develop Mar 12, 2020
@huonw huonw deleted the bugfix/803-fit-generator-automated-library branch March 12, 2020 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants