Skip to content

Add is_torch_available, is_flax_available#204

Merged
anton-l merged 4 commits into
mainfrom
add-framework-checks
Aug 17, 2022
Merged

Add is_torch_available, is_flax_available#204
anton-l merged 4 commits into
mainfrom
add-framework-checks

Conversation

@anton-l
Copy link
Copy Markdown
Member

@anton-l anton-l commented Aug 17, 2022

This adds the framework checks which are the first step to get make repo-consistency and check_repo.py working, but also will be useful for our flax integration.
Also refactoring import utils into their own file.

@anton-l anton-l requested a review from patil-suraj August 17, 2022 14:07
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

HuggingFaceDocBuilderDev commented Aug 17, 2022

The documentation is not available anymore as the PR was closed or merged.

@patrickvonplaten
Copy link
Copy Markdown
Contributor

Cool!

@anton-l anton-l merged commit df90f0c into main Aug 17, 2022
Copy link
Copy Markdown
Contributor

@patil-suraj patil-suraj left a 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.

Comment on lines -40 to -60
_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:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹

Comment on lines +40 to +41
USE_TORCH = os.environ.get("USE_TORCH", "AUTO").upper()
USE_JAX = os.environ.get("USE_FLAX", "AUTO").upper()
Copy link
Copy Markdown
Contributor

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.

@patrickvonplaten patrickvonplaten deleted the add-framework-checks branch August 31, 2022 12:27
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* Add is_<framework>_available, refactor import utils

* deps

* quality
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