File tree Expand file tree Collapse file tree 5 files changed +26
-4
lines changed Expand file tree Collapse file tree 5 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -663,6 +663,14 @@ def _export_llama(args) -> LLMEdgeManager: # noqa: C901
663
663
quantizers
664
664
).export_to_edge ()
665
665
666
+ accuracy = torch .allclose (
667
+ builder_exported_to_edge .edge_manager .exported_program ().module ()(
668
+ * builder_exported_to_edge .example_inputs
669
+ ),
670
+ builder_exported_to_edge .model (* builder_exported_to_edge .example_inputs ),
671
+ )
672
+ print (f"lfq: post to_edge accuracy: { accuracy } " )
673
+
666
674
modelname = builder_exported_to_edge .modelname
667
675
668
676
# to_backend
@@ -800,6 +808,11 @@ def _export_llama(args) -> LLMEdgeManager: # noqa: C901
800
808
# pyre-fixme[16]: Module `backends` has no attribute `qualcomm`.
801
809
canonicalize_program (builder .edge_manager .exported_program ())
802
810
811
+ print ("lfq: exported program after to_backend, graph_module" )
812
+ print (builder .edge_manager .exported_program ().graph_module )
813
+ print ("lfq: exported program after to_backend, print_readable" )
814
+ print (builder .edge_manager .exported_program ().graph_module .print_readable ())
815
+
803
816
builder = builder .to_executorch ()
804
817
805
818
if args .profile_memory :
Original file line number Diff line number Diff line change @@ -74,8 +74,6 @@ def test_llama3_2_text_decoder_aoti(self) -> None:
74
74
with tempfile .TemporaryDirectory () as tmpdir :
75
75
path = torch ._inductor .aoti_compile_and_package (
76
76
ep ,
77
- model .get_example_inputs (),
78
- kwargs = model .get_example_kwarg_inputs (),
79
77
package_path = os .path .join (tmpdir , "text_decoder.pt2" ),
80
78
)
81
79
encoder_aoti = torch ._inductor .aoti_load_package (path )
Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ def test_flamingo_vision_encoder(self) -> None:
36
36
with tempfile .TemporaryDirectory () as tmpdir :
37
37
path = torch ._inductor .aoti_compile_and_package (
38
38
ep ,
39
- model .get_example_inputs (),
40
39
package_path = os .path .join (tmpdir , "vision_encoder.pt2" ),
41
40
)
42
41
print (path )
Original file line number Diff line number Diff line change @@ -193,6 +193,19 @@ def export(self) -> "LLMEdgeManager":
193
193
dynamic_shapes = dynamic_shape ,
194
194
strict = True ,
195
195
)
196
+ print ("lfq: pre exported_module " , exported_module .graph_module )
197
+ print ("lfq: pre exported graph " , exported_module .graph )
198
+
199
+ accuracy = torch .allclose (
200
+ exported_module .module ()(* self .example_inputs ),
201
+ self .model (* self .example_inputs ),
202
+ )
203
+ print ("lfq: pre to_edge accuracy " , accuracy )
204
+
205
+ exported_module = exported_module .run_decompositions ({})
206
+ print ("lfq: post exported_module " , exported_module .graph_module )
207
+ print ("lfq: post exported graph " , exported_module .graph )
208
+
196
209
else :
197
210
logging .info ("Exporting with:" )
198
211
logging .info (f"inputs: { self .example_inputs } " )
Original file line number Diff line number Diff line change @@ -177,7 +177,6 @@ def test_tiled_token_positional_embedding_aoti(self):
177
177
with tempfile .TemporaryDirectory () as tmpdir :
178
178
path = torch ._inductor .aoti_compile_and_package (
179
179
tpe_ep ,
180
- (self .x , self .aspect_ratio ),
181
180
package_path = os .path .join (tmpdir , "tpe.pt2" ),
182
181
)
183
182
tpe_aoti = load_package (path )
You can’t perform that action at this time.
0 commit comments