Skip to content

Commit f90c6c3

Browse files
committed
temporarily disble running etLLM generated phi4 in optimum-et due to missing cache_position support
1 parent bcd8355 commit f90c6c3

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

optimum/executorch/modeling.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,14 @@ def forward(
624624
torch.Tensor: Logits output from the model.
625625
"""
626626
self.stats.on_model_execution_start()
627-
logging.debug(f"{self.model.method_meta('forward')}")
628-
logits = self.model.forward((input_ids, cache_position))[0]
627+
628+
try:
629+
logits = self.model.forward((input_ids, cache_position))[0]
630+
except Exception as e:
631+
shapes = {name: val.shape for name, val in locals().items() if hasattr(val, "shape")}
632+
print(f"Exception: {e}.\n{self.model.method_meta('forward')}\narg shapes: {shapes}")
633+
raise
634+
629635
self.stats.on_model_execution_end()
630636
return logits
631637

tests/models/test_modeling_phi4.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import pytest
2222
import torchao
23+
from executorch import version as executorch_version
2324
from executorch.extension.pybindings.portable_lib import ExecuTorchModule
2425
from packaging.version import parse
2526
from transformers import AutoConfig, AutoTokenizer
@@ -76,8 +77,8 @@ def test_phi4_text_generation(self):
7677
@slow
7778
@pytest.mark.run_slow
7879
@pytest.mark.skipif(
79-
parse(torchao.__version__) < parse("0.11.0.dev0"),
80-
reason="Only available on torchao >= 0.11.0.dev0",
80+
parse(executorch_version.__version__) > parse("0.6.0"),
81+
reason="Require cache_position support in executorch runtime. Re-enable when available.",
8182
)
8283
def test_phi4_text_generation_with_quantized_pte_from_hub(self):
8384
model_id = "pytorch/Phi-4-mini-instruct-8da4w"

0 commit comments

Comments
 (0)