-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Remove mlflow.keras raise deprecation warning to avoid keras==2.4.3 tensorflow==2.5.1 issue #4790
Conversation
@eedeleon Thanks for the contribution! The DCO check failed. Please sign off your commits by following the instructions here: https://github.com/mlflow/mlflow/runs/3569645554. See https://github.com/mlflow/mlflow/blob/master/CONTRIBUTING.rst#sign-your-work for more details. |
Signed-off-by: Weichen Xu <weichen.xu@databricks.com> Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net>
Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net>
84aa86c
to
1d3bcae
Compare
4433bb7
to
35ecd58
Compare
Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> Handle load_model Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> Handle load_model Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net>
35ecd58
to
f985c7e
Compare
Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net>
Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
I ran into this issue with keras import failing for the provided versions ../../../.local/lib/python3.8/site-packages/mlflow/keras.py:404: in log_model
../../../.local/lib/python3.8/site-packages/keras/initializers/init.py:82: AttributeError |
Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net>
Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net>
bf79b58
to
0017bd2
Compare
mlflow/keras.py
Outdated
@@ -61,9 +61,11 @@ | |||
_PIP_ENV_SUBPATH = "requirements.txt" | |||
|
|||
|
|||
def _raise_deprecation_warning(): | |||
def _raise_deprecation_warning(keras_module=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eedeleon We're planning to remove this function and drop support for keras < 2.3.0 and tensorflow < 2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. However, currently I get a failure for
keras==2.4.3
tensorflow==2.5.1
Would the correct PR be to remove it altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eedeleon Thanks for the reply. Got it. If we remove mlflow.keras._raise_deprecation_warning
that contains import keras
, does that solve the issue or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean remove. If so, yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, "remove" was missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like me to make a different PR removing the function and all calls to it? Or is someone else doing so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'd be great!
mlflow/R/mlflow/DESCRIPTION
Outdated
@@ -61,7 +61,7 @@ Suggests: | |||
testthat (>= 2.0.0), | |||
xgboost | |||
Encoding: UTF-8 | |||
RoxygenNote: 7.1.1 | |||
RoxygenNote: 7.1.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we revert this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why it was added to my branch but I reverted it
This reverts commit b37a91d. Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net>
Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…ensorflow==2.5.1 issue (mlflow#4790) * Fix RoxygenNote version (mlflow#4789) Signed-off-by: Weichen Xu <weichen.xu@databricks.com> Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Also ignore attribute error due to tf.keras and keras Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Silence keras warning if module is set Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> Handle load_model Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> Handle load_model Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Fix ordering Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Add missing space Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Change to ignore tensorflow module Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Protect against None Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Revert "Fix RoxygenNote version (mlflow#4789)" This reverts commit b37a91d. Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Remove usage of raise dep warning Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> Co-authored-by: WeichenXu <weichen.xu@databricks.com> Co-authored-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> Signed-off-by: Zach Bloss <ZachBloss@RockCentralDetroit.com>
…ensorflow==2.5.1 issue (mlflow#4790) * Fix RoxygenNote version (mlflow#4789) Signed-off-by: Weichen Xu <weichen.xu@databricks.com> Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Also ignore attribute error due to tf.keras and keras Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Silence keras warning if module is set Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> Handle load_model Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> Handle load_model Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Fix ordering Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Add missing space Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Change to ignore tensorflow module Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Protect against None Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Revert "Fix RoxygenNote version (mlflow#4789)" This reverts commit b37a91d. Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> * Remove usage of raise dep warning Signed-off-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> Co-authored-by: WeichenXu <weichen.xu@databricks.com> Co-authored-by: Eduardo De Leon <eedeleon@Eduardos-MBP.attlocal.net> Signed-off-by: Zach Bloss <ZachBloss@RockCentralDetroit.com> Signed-off-by: Zach Bloss <zacharybloss@gmail.com>
What changes are proposed in this pull request?
Adding a protection against attribute errors that arise when tensorflow.keras and keras are both installed.
https://stackoverflow.com/questions/61137954/attributeerror-module-tensorflow-python-keras-utils-generic-utils-has-no-attr
keras==2.4.3
tensorflow==2.5.1
How is this patch tested?
The above error is now silent in the original code path. The keras_module is set to tensorflow.keras and successfully logs the model
Release Notes
Patch bug due to incompatible keras and tensorflow.keras versions.
Is this a user-facing change?
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/artifacts
: Artifact stores and artifact loggingarea/build
: Build and test infrastructure for MLflowarea/docs
: MLflow documentation pagesarea/examples
: Example codearea/model-registry
: Model Registry service, APIs, and the fluent client calls for Model Registryarea/models
: MLmodel format, model serialization/deserialization, flavorsarea/projects
: MLproject format, project running backendsarea/scoring
: MLflow Model server, model deployment tools, Spark UDFsarea/server-infra
: MLflow Tracking server backendarea/tracking
: Tracking Service, tracking client APIs, autologgingInterface
area/uiux
: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/docker
: Docker use across MLflow's components, such as MLflow Projects and MLflow Modelsarea/sqlalchemy
: Use of SQLAlchemy in the Tracking Service or Model Registryarea/windows
: Windows supportLanguage
language/r
: R APIs and clientslanguage/java
: Java APIs and clientslanguage/new
: Proposals for new client languagesIntegrations
integrations/azure
: Azure and Azure ML integrationsintegrations/sagemaker
: SageMaker integrationsintegrations/databricks
: Databricks integrationsHow should the PR be classified in the release notes? Choose one:
rn/breaking-change
- The PR will be mentioned in the "Breaking Changes" sectionrn/none
- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionrn/feature
- A new user-facing feature worth mentioning in the release notesrn/bug-fix
- A user-facing bug fix worth mentioning in the release notesrn/documentation
- A user-facing documentation change worth mentioning in the release notes