Skip to content

Add strict=True explicit flag to Executorch invocations to torch.export.export #8190

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

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions backends/qualcomm/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,6 @@ def generate_multi_graph_program(
backend_config: ExecutorchBackendConfig = None,
constant_methods: Optional[Dict[str, Any]] = None,
) -> ExecutorchProgramManager:

# compile multiple graphs in qcir into single context binary
(
graph_inputs,
Expand Down Expand Up @@ -1060,7 +1059,7 @@ def forward(
outputs_dict[graph_name],
embedding_quantize,
)
prog = torch.export.export(composite_llama_module, sample_inputs)
prog = torch.export.export(composite_llama_module, sample_inputs, strict=True)
progs_dict[graph_name] = prog
# leverage ExecutorchProgramManager for generating pte with multi-methods
edge_prog_mgr = to_edge(
Expand Down
4 changes: 2 additions & 2 deletions devtools/visualization/visualization_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
def test_visualize_manual_export(server):
with server():
model = Linear(20, 30)
exported_program = torch.export.export(model, model.get_inputs())
exported_program = torch.export.export(model, model.get_inputs(), strict=True)
visualize(exported_program)
time.sleep(3.0)

Expand Down Expand Up @@ -150,7 +150,7 @@ def test_visualize_to_executorch(server):
def test_visualize_graph(server):
with server():
model = Linear(20, 30)
exported_program = torch.export.export(model, model.get_inputs())
exported_program = torch.export.export(model, model.get_inputs(), strict=True)
exported_program = to_edge_transform_and_lower(
exported_program
).exported_program()
Expand Down
2 changes: 1 addition & 1 deletion exir/emit/test/test_emit.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def forward(self, x):

m = TestModule()
example_inputs = (torch.ones(10),)
ep = torch.export.export(m, example_inputs)
ep = torch.export.export(m, example_inputs, strict=True)
edge = to_edge(
ep,
compile_config=EdgeCompileConfig(
Expand Down
2 changes: 1 addition & 1 deletion exir/program/test/test_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def forward(self, a, b, c):

inp = (torch.randn(10), torch.randn(10), torch.tensor(3))

ep = export(M(), inp)
ep = export(M(), inp, strict=True)
edge = to_edge(ep)
self.assertTrue(
torch.allclose(
Expand Down
1 change: 1 addition & 0 deletions extension/llm/modules/test/test_kv_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def forward(self, k_val: torch.Tensor, v_val: torch.Tensor):
3: torch.export.Dim.STATIC,
},
},
strict=True,
)
return exported_kv_cache

Expand Down
Loading