mirror of
https://github.com/saymrwulf/transformers.git
synced 2026-05-14 20:58:08 +00:00
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.
This commit is contained in:
parent
c8d98405a8
commit
9fe360883e
1 changed files with 1 additions and 0 deletions
|
|
@ -741,6 +741,7 @@ def is_tokenizers_available():
|
|||
return _tokenizers_available
|
||||
|
||||
|
||||
@lru_cache
|
||||
def is_vision_available():
|
||||
_pil_available = importlib.util.find_spec("PIL") is not None
|
||||
if _pil_available:
|
||||
|
|
|
|||
Loading…
Reference in a new issue