Unverified Commit 9fe36088 authored by Benjamin Muskalla's avatar Benjamin Muskalla Committed by GitHub
Browse files

Cache `is_vision_available` result (#29280)

Cache `is_vision_available`

This check is used quite often during process in image models and can take up a serious amount of time compared to the other processing steps.
parent c8d98405
...@@ -741,6 +741,7 @@ def is_tokenizers_available(): ...@@ -741,6 +741,7 @@ def is_tokenizers_available():
return _tokenizers_available return _tokenizers_available
@lru_cache
def is_vision_available(): def is_vision_available():
_pil_available = importlib.util.find_spec("PIL") is not None _pil_available = importlib.util.find_spec("PIL") is not None
if _pil_available: if _pil_available:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment