Skip to content

Commit

Permalink
Update error message when Accelerate isn't installed (huggingface#23373)
Browse files Browse the repository at this point in the history
Update error
  • Loading branch information
muellerzr authored and gojiteji committed Jun 5, 2023
1 parent 5bc8f00 commit 9b0ce4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/transformers/training_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ def _setup_devices(self) -> "torch.device":
logger.info("PyTorch: setting up devices")
if not is_sagemaker_mp_enabled() and not is_accelerate_available(check_partial_state=True):
raise ImportError(
"Using the `Trainer` with `PyTorch` requires `accelerate`: Run `pip install --upgrade accelerate`"
"Using the `Trainer` with `PyTorch` requires `accelerate>=0.19.0`: Please run `pip install transformers[torch]` or `pip install accelerate -U`"
)
if self.no_cuda:
self.distributed_state = PartialState(cpu=True, backend=self.ddp_backend)
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/utils/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def is_protobuf_available():

def is_accelerate_available(check_partial_state=False):
if check_partial_state:
return _accelerate_available and version.parse(_accelerate_version) >= version.parse("0.17.0")
return _accelerate_available and version.parse(_accelerate_version) >= version.parse("0.19.0")
return _accelerate_available


Expand Down

0 comments on commit 9b0ce4a

Please sign in to comment.