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

Fix creating local tensorflow model data fails with module import and tensorflow versioning #1205

Merged
merged 7 commits into from
Apr 14, 2023

Conversation

Fanjia-Yan
Copy link
Contributor

@Fanjia-Yan Fanjia-Yan commented Apr 13, 2023

Describe your changes and why you are making these changes

This PR contains two changes regarding local tensorflow data parameter test:

  1. Latest Tensorflow does not support Python 3.7. With older tensorflow, it does not have package module keras.saving.load_model. Therefore, we change the loading method to keras.models.load_model which presents in both new and older version of tensorflow.
  2. Local tensorflow model parameter tests fail with our Periodic Integration test. The reason is that we didn't have tensorflow as a part of param docker image. I added the image with latest version of tensorflow and mark the failed test inactive to k8s which should be reverted next release.

Related issue number (if any)

Loom demo (if any)

Checklist before requesting a review

  • I have created a descriptive PR title. The PR title should complete the sentence "This PR...".
  • I have performed a self-review of my code.
  • I have included a small demo of the changes. For the UI, this would be a screenshot or a Loom video.
  • If this is a new feature, I have added unit tests and integration tests.
  • I have run the integration tests locally and they are passing.
  • I have run the linter script locally (See python3 scripts/run_linters.py -h for usage).
  • All features on the UI continue to work correctly.
  • Added one of the following CI labels:
    • run_integration_test: Runs integration tests
    • skip_integration_test: Skips integration tests (Should be used when changes are ONLY documentation/UI)

@Fanjia-Yan Fanjia-Yan added the run_integration_test Triggers integration tests label Apr 13, 2023
@Fanjia-Yan Fanjia-Yan requested a review from kenxu95 April 13, 2023 17:34
@@ -525,6 +525,8 @@ def test_invalid_local_data(client):
)


# TODO: Remove this pytest fixture on next release.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make a task for this and put it in the format TODO(ENG-...)

@@ -10,7 +10,8 @@ RUN apt-get update && \
aqueduct-ml \
boto3 \
pandas \
pydantic
pydantic \
tensorflow==2.12.0
Copy link
Contributor

Choose a reason for hiding this comment

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

cc: @hsubbaraj-spiral I assume we don't want to pin an exact version?

@@ -114,7 +114,7 @@ def _read_local_bytes_content(path: str) -> bytes:
def _read_local_tf_keras_model(path: str) -> Any:
from tensorflow import keras

return keras.saving.load_model(path)
return keras.models.load_model(path)
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is backwards compatible (works with multiple TF versions), do we need to pin the TF version in the dockerfile?

Copy link
Contributor Author

@Fanjia-Yan Fanjia-Yan Apr 13, 2023

Choose a reason for hiding this comment

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

After I took a look at their release log:

"Moved all saving-related utilities to a new namespace, keras.saving, i.e. keras.saving.load_model, keras.saving.save_model, keras.saving.custom_object_scope, keras.saving.get_custom_objects, keras.saving.register_keras_serializable,keras.saving.get_registered_name and keras.saving.get_registered_object. The previous API locations (in keras.utils and keras.models) will stay available indefinitely, but we recommend that you update your code to point to the new API locations."

I guess we don't need to pin it to a specific version? @kenxu95 @hsubbaraj-spiral

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we lower bound it in the dockerfile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lower bounded it at the latest TF release.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually wait does lower-bounding this actually matter? @hsubbaraj-spiral Should we just rid of the constraint altogether so it always uses the latest for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wait actually I just remembered - we don't want to install tensorflow in the dockerfile right since it would take forever? I'm confused as to what the point of this change is now. I think we can assume that local data doesn't work with K8s for now, and make a task for that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'll want to just run the parameter operators locally as a long-term solution for K8s.

@Fanjia-Yan Fanjia-Yan requested a review from kenxu95 April 13, 2023 18:30
@@ -62,7 +62,7 @@ runs:

- name: Install packages needed for testing
shell: bash
run: python3 -m pip install nltk pytest-xdist tensorflow
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove tensorflow as a requirement for setup-server since we are not testing tensorflow models curently.

@Fanjia-Yan
Copy link
Contributor Author

I disabled the integration test for tf_keras parameter artifact. Since we don't have tensorflow as dependencies, previewing the artifact and executing the workflow with keras model will fail.

@Fanjia-Yan Fanjia-Yan merged commit 5a2b9a4 into main Apr 14, 2023
@vsreekanti vsreekanti deleted the eng-2797-create-local-tensorflow-model-data-fails branch April 18, 2023 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run_integration_test Triggers integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants