Repository navigation
[train][torchft][doc] Document ray train + torchft + ray data - #63563
TimothySeah wants to merge 1 commit into
Conversation
Signed-off-by: Timothy Seah <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces a new user guide for "Continuous Training Across Failures" using torchft with Ray Train, including a new code example file. The review feedback suggests improving code portability by using ray.train.torch.get_device() instead of hardcoding "cuda" and using a dynamic storage path. Additionally, several TODO items in the documentation regarding API links and Ray Data integration need to be resolved before finalization.
| model.conv1 = torch.nn.Conv2d( | ||
| 1, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False | ||
| ) | ||
| model.to("cuda") |
There was a problem hiding this comment.
Hardcoding "cuda" is discouraged in Ray Train. It is better to use ray.train.torch.get_device() to ensure the code is portable and correctly uses the device assigned by Ray, especially in multi-GPU environments.
| model.to("cuda") | |
| device = ray.train.torch.get_device() | |
| model.to(device) |
| transport = PGTransport( | ||
| pg, | ||
| timeout=timedelta(seconds=10), | ||
| device="cuda", |
|
|
||
| # Training loop | ||
| for images, labels in train_loader: | ||
| images, labels = images.to("cuda"), labels.to("cuda") |
| run_config=ray.train.RunConfig( | ||
| # In a multi-node cluster set storage_path to a path accessible | ||
| # from every worker node (e.g. NFS or cloud storage). | ||
| storage_path="/mnt/cluster_storage", |
There was a problem hiding this comment.
| **TODO:** replace the inline class reference once ``TorchftConfig`` is in | ||
| the public API reference, and link to it from here. |
| **TODO:** document the Ray Data + torchft DDP path, including the dataset | ||
| construction, the per-worker iterator pattern, and any ``TorchftConfig`` | ||
| differences. |
|
Another thing to note: report only works when replacement worker recovers and also reports! |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
This pull request has been automatically closed because there has been no more activity in the 14 days Please feel free to reopen or open a new pull request if you'd still like this to be addressed. Again, you can always ask for help on our discussion forum or Ray's public slack channel. Thanks again for your contribution! |
Disclaimer: this is a draft PR. I will improve the wording and clean up / test the code examples before submitting.