Skip to content

Commit

Permalink
allow for multiGPU to be empty, run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
anhuong committed Mar 25, 2024
1 parent 130267b commit 03d7866
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build/accelerate_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def main():

# parse multiGPU args
multi_gpu_args = []
if json_configs.get("multiGPU"):
if json_configs.get("multiGPU") is not None:
logging.info("Using multi-GPU configs: %s", json_configs.get("multiGPU"))
for key, val in json_configs["multiGPU"].items():
multi_gpu_args.append(f"--{key}")
Expand All @@ -69,15 +69,15 @@ def main():
"FSDP_DEFAULTS_FILE_PATH", "/app/accelerate_fsdp_defaults.yaml"
)
if os.path.exists(fsdp_filepath):
logging.info(f"Setting accelerate config file to: {fsdp_filepath}")
logging.info("Setting accelerate config file to: %s", fsdp_filepath)
multi_gpu_args.append("--config_file")
multi_gpu_args.append(fsdp_filepath)

# add num_processes to overwrite config file set one
if not json_configs.get("multiGPU").get("num_processes"):
num_gpus = torch.cuda.device_count()
if num_gpus > 1:
logging.info(f"Setting accelerate num processes to {num_gpus}")
logging.info("Setting accelerate num processes to %s", num_gpus)
multi_gpu_args.append("--num_processes")
multi_gpu_args.append(str(num_gpus))

Expand Down

0 comments on commit 03d7866

Please sign in to comment.