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

Improve error handling for missing TensorFlow dependency in KerasCV #2435

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SamanehSaadat
Copy link
Member

This PR addresses this issue: user doesn't have tensorflow installed and doesn't expect to get error as they're using pytorch backend.

raise ImportError(
"To use KerasCV, please install TensorFlow: `pip install tensorflow`. "
"The TensorFlow package is required for data preprocessing with any backend."
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will keras-cv always depend on tensorflow for data processing layers?

@@ -46,7 +46,14 @@
from tensorflow import split # noqa: F403, F401
Copy link
Contributor

Choose a reason for hiding this comment

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

These imports will also fail in case tensorflow is not installed. Making this same change across all the files makes it more hard to maintain. Instead, this should be wrapped around in some module like keras_cv/utils/conditional_imports.py and import tensorflow from this wrapper.

Copy link
Collaborator

@divyashreepathihalli divyashreepathihalli left a comment

Choose a reason for hiding this comment

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

Thanks Samaneh! looks like code reformatting is needed!

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.

4 participants