fix: mute DDP barrier and find_unused_parameters stderr warnings
Browse files- model/scripts/train.py +7 -1
model/scripts/train.py
CHANGED
|
@@ -512,9 +512,15 @@ def main():
|
|
| 512 |
rank, world = 0, 1
|
| 513 |
if use_dist:
|
| 514 |
import torch.distributed as dist
|
|
|
|
|
|
|
|
|
|
| 515 |
torch.cuda.set_device(local_rank)
|
| 516 |
device = torch.device(f"cuda:{local_rank}")
|
| 517 |
-
|
|
|
|
|
|
|
|
|
|
| 518 |
if use_dist and not args.smoke:
|
| 519 |
print(f"[dist] rank {rank}/{world} on {device} (DDP, grad-sync every step)")
|
| 520 |
R0 = (rank == 0)
|
|
|
|
| 512 |
rank, world = 0, 1
|
| 513 |
if use_dist:
|
| 514 |
import torch.distributed as dist
|
| 515 |
+
import warnings
|
| 516 |
+
warnings.filterwarnings("ignore", message=".*find_unused_parameters.*")
|
| 517 |
+
warnings.filterwarnings("ignore", category=UserWarning, module="torch.distributed")
|
| 518 |
torch.cuda.set_device(local_rank)
|
| 519 |
device = torch.device(f"cuda:{local_rank}")
|
| 520 |
+
try:
|
| 521 |
+
dist.init_process_group(backend="nccl", rank=rank, world_size=world, device_id=device)
|
| 522 |
+
except TypeError:
|
| 523 |
+
dist.init_process_group(backend="nccl", rank=rank, world_size=world)
|
| 524 |
if use_dist and not args.smoke:
|
| 525 |
print(f"[dist] rank {rank}/{world} on {device} (DDP, grad-sync every step)")
|
| 526 |
R0 = (rank == 0)
|