Fix 'local_rank' AttiributeError in Trainer class (#24297)

fix attribute error
This commit is contained in:
Tomoko Uchida 2023-06-27 02:38:29 +09:00 committed by GitHub
parent 850cf4af0c
commit c9fd49853f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3250,7 +3250,7 @@ class Trainer:
elif is_sagemaker_mp_enabled():
tensors = smp_gather(tensors)
elif (self.args.distributed_state is not None and self.args.distributed_state.distributed_type != "NO") or (
self.args.distributed_state is None and self.local_rank != -1
self.args.distributed_state is None and self.args.local_rank != -1
):
tensors = distributed_concat(tensors)
return tensors