-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add is_torch_available
, is_flax_available
#204
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
Conversation
The documentation is not available anymore as the PR was closed or merged. |
Cool! |
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! Thanks a lot for the cleanup.
_transformers_available = importlib.util.find_spec("transformers") is not None | ||
try: | ||
_transformers_version = importlib_metadata.version("transformers") | ||
logger.debug(f"Successfully imported transformers version {_transformers_version}") | ||
except importlib_metadata.PackageNotFoundError: | ||
_transformers_available = False | ||
|
||
|
||
_inflect_available = importlib.util.find_spec("inflect") is not None | ||
try: | ||
_inflect_version = importlib_metadata.version("inflect") | ||
logger.debug(f"Successfully imported inflect version {_inflect_version}") | ||
except importlib_metadata.PackageNotFoundError: | ||
_inflect_available = False | ||
|
||
|
||
_unidecode_available = importlib.util.find_spec("unidecode") is not None | ||
try: | ||
_unidecode_version = importlib_metadata.version("unidecode") | ||
logger.debug(f"Successfully imported unidecode version {_unidecode_version}") | ||
except importlib_metadata.PackageNotFoundError: |
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.
🧹
USE_TORCH = os.environ.get("USE_TORCH", "AUTO").upper() | ||
USE_JAX = os.environ.get("USE_FLAX", "AUTO").upper() |
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.
maybe let's not add TF and JAX stuff just yet as we don't have any immediate plans to support other frameworks. But also fine with it, don't feel strongly about this.
* Add is_<framework>_available, refactor import utils * deps * quality
This adds the framework checks which are the first step to get
make repo-consistency
andcheck_repo.py
working, but also will be useful for our flax integration.Also refactoring import utils into their own file.