-
Notifications
You must be signed in to change notification settings - Fork 159
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
[2/n] Add setting function to set seeds to the graph #894
Conversation
@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
return datapipe | ||
|
||
|
||
def _set_graph_seeds(datapipe: DataPipe, seed_generator: torch.Generator, worker_id: int = 0) -> DataPipe: |
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.
I am using a private name because I don't like the name of this function. LMK if you have any better idea.
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.
_set_worker_seed
_set_worker_seed_for_dp_graph
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.
LGTM! A few comments:
return datapipe | ||
|
||
|
||
def _set_graph_seeds(datapipe: DataPipe, seed_generator: torch.Generator, worker_id: int = 0) -> DataPipe: |
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.
_set_worker_seed
_set_worker_seed_for_dp_graph
db08b88
to
fd7808a
Compare
@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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.
The BFS looks good to me. Can we add a test that confirms the result's ordering? (It might already exist.)
@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Changes
list_dps
with a new argument (to make sure allexclusive
)DataPipes
will be excluded even though they are the predecessors of the non-excludedDataPipe
.list_dps
to use BFS to return the list ofDataPipes
._set_worker_seed_for_dp_graph
to set seeds forDataPipes
beforesharding_filter
with the same seed generator and set different seeds forDataPipes
aftersharding_filter
with the worker-local seed generator.Step 2 for #885