Skip to content

Commit

Permalink
Expand sanity checks (#905)
Browse files Browse the repository at this point in the history
* Expand sanity checks

* multi_cpu to cpu
  • Loading branch information
muellerzr authored Dec 6, 2022
1 parent e6b61da commit 2359af1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/accelerate/commands/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,8 +1002,12 @@ def sagemaker_launcher(sagemaker_config: SageMakerConfig, args):

def launch_command(args):
# Sanity checks
if sum([args.multi_gpu, args.tpu, args.use_deepspeed, args.use_fsdp]) > 1:
raise ValueError("You can only pick one between `--multi_gpu`, `--use_deepspeed`, `--tpu`, `--use_fsdp`.")
if sum([args.multi_gpu, args.cpu, args.tpu, args.mps, args.use_deepspeed, args.use_fsdp]) > 1:
raise ValueError(
"You can only use one of `--cpu`, `--multi_gpu`, `--mps`, `--tpu`, `--use_deepspeed`, `--use_fsdp` at a time."
)
if args.multi_gpu and args.num_processes < 2:
raise ValueError("You need to use at least 2 processes to use `--multi_gpu`.")

defaults = None
warned = []
Expand Down

0 comments on commit 2359af1

Please sign in to comment.