I’m launching my script via accelerate launch --num_processes 1 train.py
. However, the following code is printing the following output:
# Code
logger.warning(
"Process rank: %s, device: %s, n_gpu: %s, distributed training: %s, 16-bits training: %s",
training_args.local_rank,
training_args.device,
training_args.n_gpu,
bool(training_args.local_rank != -1),
training_args.fp16,
)
# Output
Process rank: 0, device: cuda:0, n_gpu: 4, distributed training: True, 16-bits training: True
Why is n_gpu
4, and why is the value of local_rank
not being set to the default value of -1
?
The code runs fine when I set CUDA_VISIBLE_DEVICES=0
, but I would think that HF Accelerate would handle this without having to set environment variables.