-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* anyinstruct bugfix: bring back val_split code * evaluation generation with multi-processing + test * validation loss for training * refactor prepare_dataset
- Loading branch information
Showing
7 changed files
with
170 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
|
||
import torch.distributed | ||
from torch import multiprocessing as mp | ||
|
||
from ultravox.training import ddp_utils | ||
|
||
os.environ["MASTER_ADDR"] = "localhost" | ||
os.environ["MASTER_PORT"] = "12355" | ||
|
||
|
||
def test_all_gather_list(): | ||
# Test without DDP | ||
verify_all_gather(0, 1) | ||
# Test with DDP: world_size = 2, 4 | ||
mp.spawn(verify_all_gather, args=(2,), nprocs=2, join=True) | ||
mp.spawn(verify_all_gather, args=(4,), nprocs=4, join=True) | ||
|
||
|
||
def verify_all_gather(rank: int, world_size: int, k: int = 4): | ||
if world_size > 1: | ||
torch.distributed.init_process_group("gloo", rank=rank, world_size=world_size) | ||
d = [rank * k + i for i in range(k)] | ||
all_d = ddp_utils.all_gather_list(d) | ||
assert all_d == list(range(world_size * k)) | ||
if world_size > 1: | ||
torch.distributed.destroy_process_group() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters