-
Notifications
You must be signed in to change notification settings - Fork 330
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
base: master
Are you sure you want to change the base?
Conversation
raise ImportError( | ||
"To use KerasCV, please install TensorFlow: `pip install tensorflow`. " | ||
"The TensorFlow package is required for data preprocessing with any backend." | ||
) |
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.
Will keras-cv always depend on tensorflow for data processing layers?
@@ -46,7 +46,14 @@ | |||
from tensorflow import split # noqa: F403, F401 |
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.
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.
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.
Thanks Samaneh! looks like code reformatting is needed!
This PR addresses this issue: user doesn't have
tensorflow
installed and doesn't expect to get error as they're usingpytorch
backend.