Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kiya00 committed Nov 12, 2024
1 parent c6bf77b commit 4780620
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion thunder/dynamo/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def __call__(self, gm: torch.fx.GraphModule, sample_args: list[torch.SymInt, tor
return split_module

def save_reproducer_to_folder(self, reproducer_folder: str | PathLike):
"""Save the reproducer script for the GraphModule executed by Thunder to the specified `reproducer_folder`.
"""
Save the reproducer script for the GraphModule executed by Thunder to the specified `reproducer_folder`.
Each saved script is named as "g[graph_id]_thunder_[module_id]", where:
- `graph_id` indexes the graph generated by Dynamo, which is then passed to Thunder.
- `module_id` indexes the submodule split by the :func:`thunder.dynamo.utils._splitter`.
Expand Down
7 changes: 6 additions & 1 deletion thunder/dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,19 @@ def _get_example_inputs_from_placeholder(
return _get_example_input_tensor_metadata(ev)
return ev.detach().clone().requires_grad_(ev.requires_grad)

check("example_value" in node.meta, lambda: "example_value does not exist in the meta of {node}", ValueError)
check("example_value" in node.meta, lambda: f"example_value does not exist in the meta of {node}", ValueError)
example_value = node.meta["example_value"]

if isinstance(example_value, torch.Tensor):
ev_metadata = _get_example_input_tensor_metadata(example_value)
if only_metadata:
return ev_metadata
return _create_random_tensor_from_tensor_metadata(ev_metadata)
elif isinstance(example_value, tuple):
ev_metadatas = tuple(_get_example_input_tensor_metadata(e_v) for e_v in example_value)
if only_metadata:
return ev_metadatas
return tuple(_create_random_tensor_from_tensor_metadata(ev_metadata) for ev_metadata in ev_metadatas)
elif isinstance(example_value, torch.types.py_sym_types):
return example_value.node.hint
else:
Expand Down

0 comments on commit 4780620

Please sign in to comment.