Skip to content
Open
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
Diff view
9 changes: 9 additions & 0 deletions autoparallel/input_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ def _check_forward_args(args, expected_inputs, dynamic_dims=frozenset()):
expected_inputs: Expected shapes from _compute_expected_inputs.
dynamic_dims: Set of (arg_index, dim) pairs for dynamic dimensions.
"""
# Skip validation during make_fx tracing -- FakeTensors have different

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally this check only runs after AutoParallel has finished, as is meant as a safety for users calling the parallelized model in their code.

When we do torch.compile(parallel_mod), this check should normally be properly captured.

So I'm not sure if this skipping is actually doing what we want globally, but it would be good to discuss with others from the GraphTrainer if they should just completely skip this in their implementation of AutoParallelGraph

# device/repr than the meta tensors used during AutoParallel tracing.
if any(
a.is_meta or getattr(a, "fake_mode", None) is not None
for a in args
if isinstance(a, torch.Tensor)
):
return

if len(args) != len(expected_inputs):
raise ValueError(
f"AutoParallel: expected {len(expected_inputs)} arguments "
Expand Down
Loading