8000 [Dyamo] Replace unimplemented with unimplemented_v2 for variables/distributed by yanboliang · Pull Request #148500 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[Dyamo] Replace unimplemented with unimplemented_v2 for variables/distributed #148500

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
20 changes: 17 additions & 3 deletions torch/_dynamo/variables/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from .. import compiled_autograd, variables
from .._trace_wrapped_higher_order_op import trace_wrapped
from ..exc import unimplemented
from ..exc import unimplemented_v2
from ..external_utils import call_module_hooks_from_backward_state
from ..guards import GuardBuilder, install_guard
from ..source import AttrSource
Expand All @@ -56,7 +56,14 @@ class DistributedVariable(VariableTracker):
def __init__(self, value, **kwargs) -> None:
super().__init__(**kwargs)
if not DistributedVariable.is_available():
unimplemented("torch.distributed package is not available!")
unimplemented_v2(
gb_type="torch.distributed package is not available!",
context="",
explanation="The PyTorch package doesn't include torch.distributed when builing from source.",
hints=[
"Set USE_DISTRIBUTED=1 to enable it when building PyTorch from source."
],
)
self.value = value

def python_type(self):
Expand Down Expand Up @@ -339,7 +346,14 @@ def create(
user_pre_hooks: VariableTracker,
):
if not compiled_autograd.compiled_autograd_enabled:
unimplemented("module-level backwards hooks require compiled autograd")
unimplemented_v2(
gb_type="Module-level backwards hooks require compiled autograd.",
context="",
explanation="",
hints=[
"Enable compiled autograd by setting torch._dynamo.config.compiled_autograd = True."
],
)

def _in_graph_bw_hooks(bw_state: BackwardState):
"""
Expand Down
Loading
0