11
11
from executorch .examples .export .utils import _CAPTURE_CONFIG , _EDGE_COMPILE_CONFIG
12
12
from executorch .examples .models import MODEL_NAME_TO_MODEL
13
13
14
- # pyre-ignore[21]: Could not find module `executorch.extension.pybindings.portable`.
15
- from executorch .extension .pybindings .portable import ( # @manual
16
- _load_for_executorch_from_buffer ,
17
- )
18
-
19
14
20
15
class ExportTest (unittest .TestCase ):
21
16
def _assert_eager_lowered_same_result (
@@ -28,13 +23,11 @@ def _assert_eager_lowered_same_result(
28
23
)
29
24
30
25
executorch_model = edge_model .to_executorch ()
31
- # pyre-ignore
32
- pte_model = _load_for_executorch_from_buffer (executorch_model .buffer )
33
26
34
27
with torch .no_grad ():
35
28
eager_output = eager_model (* example_inputs )
36
29
with torch .no_grad ():
37
- executorch_output = pte_model . forward ( example_inputs )
30
+ executorch_output = executorch_model . exported_program ( * example_inputs )
38
31
self .assertTrue (
39
32
torch .allclose (eager_output , executorch_output [0 ], rtol = 1e-5 , atol = 1e-5 )
40
33
)
@@ -50,3 +43,9 @@ def test_mv2_export_to_executorch(self):
50
43
eager_model = eager_model .eval ()
51
44
52
45
self ._assert_eager_lowered_same_result (eager_model , example_inputs )
46
+
47
+ def test_vit_export_to_executorch (self ):
48
+ eager_model , example_inputs = MODEL_NAME_TO_MODEL ["vit" ]()
49
+ eager_model = eager_model .eval ()
50
+
51
+ self ._assert_eager_lowered_same_result (eager_model , example_inputs )
0 commit comments