From 2ca61ed2b0442b9b64e1aa4cdffbaee0c8a4173c Mon Sep 17 00:00:00 2001 From: Mengwei Liu Date: Fri, 3 Oct 2025 14:50:45 -0700 Subject: [PATCH 1/3] Address comments on #158 * Moved attention check earlier * Check for .ptd file as well in unit test --- install_dev.py | 6 +++--- optimum/exporters/executorch/recipes/cuda.py | 8 ++++---- tests/models/test_modeling_voxtral.py | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/install_dev.py b/install_dev.py index c31e76a..6a7b5c3 100644 --- a/install_dev.py +++ b/install_dev.py @@ -5,10 +5,10 @@ def install_torch_nightly_deps(): """Install torch related dependencies from pinned nightly""" - EXECUTORCH_NIGHTLY_VERSION = "dev20250916" - TORCHAO_NIGHTLY_VERSION = "dev20250916" + EXECUTORCH_NIGHTLY_VERSION = "dev20251003" + TORCHAO_NIGHTLY_VERSION = "dev20251003" # Torch nightly is aligned with pinned nightly in https://github.com/pytorch/executorch/blob/main/install_requirements.py#L74 - TORCH_NIGHTLY_VERSION = "dev20250916" + TORCH_NIGHTLY_VERSION = "dev20251003" subprocess.check_call( [ sys.executable, diff --git a/optimum/exporters/executorch/recipes/cuda.py b/optimum/exporters/executorch/recipes/cuda.py index 5aa6973..2fcaf73 100644 --- a/optimum/exporters/executorch/recipes/cuda.py +++ b/optimum/exporters/executorch/recipes/cuda.py @@ -114,10 +114,6 @@ def _lower_to_executorch( ) return {pte_name: et_prog} - # Decomposes SDPA since we don't have a flash attention kernel for it yet. - with torch.nn.attention.sdpa_kernel([SDPBackend.MATH]), torch.no_grad(): - exported_progs = model.export() - if ( model.config._attn_implementation == "custom_sdpa" or model.config._attn_implementation == "custom_sdpa_ring_kv_cache" @@ -126,4 +122,8 @@ def _lower_to_executorch( "Custom SDPA implementation is not supported for CUDA yet. Please use 'flash_attention' instead." ) + # Decomposes SDPA since we don't have a flash attention kernel for it yet. + with torch.nn.attention.sdpa_kernel([SDPBackend.MATH]), torch.no_grad(): + exported_progs = model.export() + return _lower_to_executorch(exported_progs, model.metadata) diff --git a/tests/models/test_modeling_voxtral.py b/tests/models/test_modeling_voxtral.py index e0b13e6..bae8b72 100644 --- a/tests/models/test_modeling_voxtral.py +++ b/tests/models/test_modeling_voxtral.py @@ -351,3 +351,4 @@ def test_voxtral_export_to_executorch_cuda_recipe(self): ) subprocess.run(cmd, shell=True, check=True) self.assertTrue(os.path.exists(os.path.join(output_dir, "model.pte"))) + self.assertTrue(os.path.exists(os.path.join(output_dir, "aoti_cuda_blob.ptd"))) From cdb4613ab7787946baf9a3a437d3e3b5f9d725fe Mon Sep 17 00:00:00 2001 From: Mengwei Liu Date: Fri, 3 Oct 2025 15:08:07 -0700 Subject: [PATCH 2/3] Fix version --- install_dev.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_dev.py b/install_dev.py index 6a7b5c3..04524f9 100644 --- a/install_dev.py +++ b/install_dev.py @@ -15,7 +15,7 @@ def install_torch_nightly_deps(): "-m", "pip", "install", - f"executorch==1.0.0.{EXECUTORCH_NIGHTLY_VERSION}", + f"executorch==1.1.0.{EXECUTORCH_NIGHTLY_VERSION}", f"torch==2.10.0.{TORCH_NIGHTLY_VERSION}", f"torchvision==0.25.0.{TORCH_NIGHTLY_VERSION}", f"torchaudio==2.8.0.{TORCH_NIGHTLY_VERSION}", From f03e2ad5abd04f7dac7830c60307650d2a428e0e Mon Sep 17 00:00:00 2001 From: Mengwei Liu Date: Fri, 3 Oct 2025 15:28:09 -0700 Subject: [PATCH 3/3] Only change ExecuTorch nightly --- install_dev.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_dev.py b/install_dev.py index 04524f9..6ce3a27 100644 --- a/install_dev.py +++ b/install_dev.py @@ -6,9 +6,9 @@ def install_torch_nightly_deps(): """Install torch related dependencies from pinned nightly""" EXECUTORCH_NIGHTLY_VERSION = "dev20251003" - TORCHAO_NIGHTLY_VERSION = "dev20251003" + TORCHAO_NIGHTLY_VERSION = "dev20250916" # Torch nightly is aligned with pinned nightly in https://github.com/pytorch/executorch/blob/main/install_requirements.py#L74 - TORCH_NIGHTLY_VERSION = "dev20251003" + TORCH_NIGHTLY_VERSION = "dev20250916" subprocess.check_call( [ sys.executable,