From 5eb3d3c7023ed0522d3c743ee2e13d896a3aa788 Mon Sep 17 00:00:00 2001 From: Zachary Mueller Date: Wed, 7 Jun 2023 16:21:51 -0400 Subject: [PATCH] Up pinned accelerate version (#24089) * Min accelerate * Also min version * Min accelerate * Also min version * To different minor version * Empty --- setup.py | 2 +- src/transformers/dependency_versions_table.py | 2 +- src/transformers/training_args.py | 4 ++-- src/transformers/utils/import_utils.py | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 394cc9cb25c877..603d0337c195e6 100644 --- a/setup.py +++ b/setup.py @@ -98,7 +98,7 @@ # 2. once modified, run: `make deps_table_update` to update src/transformers/dependency_versions_table.py _deps = [ "Pillow", - "accelerate>=0.19.0", + "accelerate>=0.20.1", "av==9.2.0", # Latest version of PyAV (10.0.0) has issues with audio stream. "beautifulsoup4", "black~=23.1", diff --git a/src/transformers/dependency_versions_table.py b/src/transformers/dependency_versions_table.py index 9419287ae2cf8c..c97fdc348d11ef 100644 --- a/src/transformers/dependency_versions_table.py +++ b/src/transformers/dependency_versions_table.py @@ -3,7 +3,7 @@ # 2. run `make deps_table_update`` deps = { "Pillow": "Pillow", - "accelerate": "accelerate>=0.19.0", + "accelerate": "accelerate>=0.20.1", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", diff --git a/src/transformers/training_args.py b/src/transformers/training_args.py index 441a546e05ff21..d666b40acb0baa 100644 --- a/src/transformers/training_args.py +++ b/src/transformers/training_args.py @@ -1668,9 +1668,9 @@ def _setup_devices(self) -> "torch.device": requires_backends(self, ["torch"]) logger.info("PyTorch: setting up devices") if not is_sagemaker_mp_enabled(): - if not is_accelerate_available(check_partial_state=True): + if not is_accelerate_available(min_version="0.20.1"): raise ImportError( - "Using the `Trainer` with `PyTorch` requires `accelerate>=0.19.0`: Please run `pip install transformers[torch]` or `pip install accelerate -U`" + "Using the `Trainer` with `PyTorch` requires `accelerate>=0.20.1`: Please run `pip install transformers[torch]` or `pip install accelerate -U`" ) AcceleratorState._reset_state(reset_partial_state=True) self.distributed_state = None diff --git a/src/transformers/utils/import_utils.py b/src/transformers/utils/import_utils.py index 39d72af305e5b0..93e5e74bba5df2 100644 --- a/src/transformers/utils/import_utils.py +++ b/src/transformers/utils/import_utils.py @@ -508,9 +508,9 @@ def is_protobuf_available(): return importlib.util.find_spec("google.protobuf") is not None -def is_accelerate_available(check_partial_state=False): - if check_partial_state: - return _accelerate_available and version.parse(_accelerate_version) >= version.parse("0.19.0") +def is_accelerate_available(min_version: str = None): + if min_version is not None: + return _accelerate_available and version.parse(_accelerate_version) >= version.parse(min_version) return _accelerate_available