-
Notifications
You must be signed in to change notification settings - Fork 68
fix: Use default torch timeout for nccl watchdog unless overridden #521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mergify
merged 1 commit into
instructlab:main
from
booxter:revert-to-default-timeout-for-pytorch
May 20, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,39 @@ | ||
# Standard | ||
from unittest import mock | ||
import datetime | ||
|
||
# Third Party | ||
import pytest | ||
|
||
# First Party | ||
from instructlab.training import main_ds | ||
|
||
|
||
def test__get_collective_timeout(): | ||
# Test with default timeout | ||
assert main_ds._get_collective_timeout() is None | ||
|
||
# Test with custom timeout | ||
timeout = 1234 | ||
with mock.patch.dict( | ||
main_ds.os.environ, {"INSTRUCTLAB_NCCL_TIMEOUT_MS": str(timeout)} | ||
): | ||
assert main_ds._get_collective_timeout() == datetime.timedelta( | ||
milliseconds=timeout | ||
) | ||
|
||
# Test with invalid timeout (negative) | ||
invalid_timeout = "-100" | ||
with mock.patch.dict( | ||
main_ds.os.environ, {"INSTRUCTLAB_NCCL_TIMEOUT_MS": invalid_timeout} | ||
): | ||
with pytest.raises(ValueError): | ||
main_ds._get_collective_timeout() | ||
|
||
# Test with invalid timeout (string) | ||
invalid_timeout = "invalid" | ||
with mock.patch.dict( | ||
main_ds.os.environ, {"INSTRUCTLAB_NCCL_TIMEOUT_MS": invalid_timeout} | ||
): | ||
with pytest.raises(ValueError): | ||
main_ds._get_collective_timeout() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worthwhile to also update the
README.md
to let people know that this env can be used to set the timeoutThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already documented in README:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, I must have missed that. Thank you!