Skip to content
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

executorch/extension/llm/modules/test #7393

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions extension/llm/modules/test/test_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def test_attention_export(self):
(self.x, self.x),
kwargs={"input_pos": self.input_pos},
dynamic_shapes=self.dynamic_shapes,
strict=True,
)
et_res = et_mha_ep.module()(self.x, self.x, input_pos=self.input_pos)
tt_res = self.tt_mha(self.x, self.x, input_pos=self.input_pos)
Expand Down Expand Up @@ -196,6 +197,7 @@ def test_attention_executorch(self):
(self.x, self.x),
kwargs={"input_pos": self.input_pos},
dynamic_shapes=self.dynamic_shapes,
strict=True,
)
et_program = to_edge(
et_mha_ep,
Expand Down
7 changes: 5 additions & 2 deletions extension/llm/modules/test/test_position_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ def test_tile_positional_embedding_smoke(self):
self.assertTrue(torch.allclose(y, ref_y))

def test_tile_positional_embedding_export(self):

tpe_ep = torch.export.export(
self.tpe,
(self.x, self.aspect_ratio),
dynamic_shapes=(
self.dynamic_shape,
None,
), # assuming aspect ratio is static
strict=True,
)

y = tpe_ep.module()(self.x, self.aspect_ratio)
Expand Down Expand Up @@ -91,6 +91,7 @@ def test_tile_positional_embedding_et(self):
self.dynamic_shape,
None,
), # assuming aspect ratio is static
strict=True,
)
et_program = to_edge(
tpe_ep,
Expand Down Expand Up @@ -148,14 +149,14 @@ def test_tiled_token_positional_embedding_smoke(self):
assert_close(y, ref_y)

def test_tiled_token_positional_embedding_export(self):

tpe_ep = torch.export.export(
self.tpe,
(self.x, self.aspect_ratio),
dynamic_shapes=(
self.dynamic_shape,
None,
), # assuming aspect ratio is static
strict=True,
)

y = tpe_ep.module()(self.x, self.aspect_ratio)
Expand All @@ -172,6 +173,7 @@ def test_tiled_token_positional_embedding_aoti(self):
self.dynamic_shape,
None,
), # assuming aspect ratio is static
strict=True,
)

with tempfile.TemporaryDirectory() as tmpdir:
Expand All @@ -195,6 +197,7 @@ def test_tiled_token_positional_embedding_et(self):
self.dynamic_shape,
None,
), # assuming aspect ratio is static
strict=True,
)
et_program = to_edge(
tpe_ep,
Expand Down