Avoid graph break due to unsupported frozenset#7105
Merged
loadams merged 3 commits intodeepspeedai:masterfrom Mar 4, 2025
Merged
Avoid graph break due to unsupported frozenset#7105loadams merged 3 commits intodeepspeedai:masterfrom
loadams merged 3 commits intodeepspeedai:masterfrom
Conversation
This PR is a continuation of the efforts to improve Deepspeed performance when using PyTorch compile. The fetch_sub_module routine makes use of the frozenset which is problematic because: 1) iter_params() returns an iterable over model parameters 2) frozenset() wraps this iterable, making it unmodifiable 3) PyTorch’s compilation process cannot infer how frozenset() interacts with tensors, leading to a graph break. If we replace the frozenset with a modifiable set, there is no longer graph break. Signed-off-by: Max Kovalenko <mkovalenko@habana.ai>
tjruwase
approved these changes
Mar 3, 2025
tohtana
approved these changes
Mar 3, 2025
saurabhkoshatwar
pushed a commit
to saurabhkoshatwar/DeepSpeed
that referenced
this pull request
Mar 8, 2025
This PR is a continuation of the efforts to improve Deepspeed performance when using PyTorch compile. The `fetch_sub_module()` routine makes use of the `frozenset` which is problematic because: 1. `iter_params` returns an iterable over model parameters 2. `frozenset` wraps this iterable, making it unmodifiable 3. PyTorch’s compilation process cannot infer how `frozenset` interacts with tensors, leading to a graph break. If we replace the `frozenset` with a modifiable `set`, then there is no longer such graph break. Signed-off-by: Max Kovalenko <mkovalenko@habana.ai> Co-authored-by: Masahiro Tanaka <81312776+tohtana@users.noreply.github.com> Co-authored-by: Olatunji Ruwase <olruwase@microsoft.com> Signed-off-by: Saurabh <saurabhkoshatwar1996@gmail.com>
mauryaavinash95
pushed a commit
to DataStates/DeepSpeed
that referenced
this pull request
Mar 20, 2025
This PR is a continuation of the efforts to improve Deepspeed performance when using PyTorch compile. The `fetch_sub_module()` routine makes use of the `frozenset` which is problematic because: 1. `iter_params` returns an iterable over model parameters 2. `frozenset` wraps this iterable, making it unmodifiable 3. PyTorch’s compilation process cannot infer how `frozenset` interacts with tensors, leading to a graph break. If we replace the `frozenset` with a modifiable `set`, then there is no longer such graph break. Signed-off-by: Max Kovalenko <mkovalenko@habana.ai> Co-authored-by: Masahiro Tanaka <81312776+tohtana@users.noreply.github.com> Co-authored-by: Olatunji Ruwase <olruwase@microsoft.com>
loadams
pushed a commit
that referenced
this pull request
Mar 25, 2025
This PR is a continuation of the efforts to improve Deepspeed performance when using PyTorch compile. The `fetch_sub_module()` routine makes use of the `frozenset` which is problematic because: 1. `iter_params` returns an iterable over model parameters 2. `frozenset` wraps this iterable, making it unmodifiable 3. PyTorch’s compilation process cannot infer how `frozenset` interacts with tensors, leading to a graph break. If we replace the `frozenset` with a modifiable `set`, then there is no longer such graph break. Signed-off-by: Max Kovalenko <mkovalenko@habana.ai> Co-authored-by: Masahiro Tanaka <81312776+tohtana@users.noreply.github.com> Co-authored-by: Olatunji Ruwase <olruwase@microsoft.com> Signed-off-by: Logan Adams <loadams@microsoft.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is a continuation of the efforts to improve Deepspeed performance when using PyTorch compile.
The
fetch_sub_module()routine makes use of thefrozensetwhich is problematic because:iter_paramsreturns an iterable over model parametersfrozensetwraps this iterable, making it unmodifiablefrozensetinteracts with tensors, leading to a graph break.If we replace the
frozensetwith a modifiableset, then there is no longer such graph break.