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

Handle model state in benchmark CI jobs #7432

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .github/workflows/apple-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ jobs:
script: |
set -eux

echo "Setting XCode version"
sudo xcode-select -switch /Applications/Xcode_16.app

echo "::group::Setting up CI environment"
.ci/scripts/setup-conda.sh

Expand Down
9 changes: 9 additions & 0 deletions extension/benchmark/apple/Benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ kernels_portable.xcframework
kernels_quantized.xcframework
```

#### MLState
The prebuilt frameworks do not work with CoreML models that use MLState, which is used in LLM models exported for iOS18. When executing the *.pte file, you will see an error like:

```
The input feature for X must be an MLState, but it was not.
```

If you encounter this issue, build the frameworks locally (option 2) using **XCode 16.0** or higher.

## Adding Models and Resources

Place your exported model files (`.pte`) and any other resources (e.g., `tokenizer.bin`) into the `extension/benchmark/apple/Benchmark/Resources` directory:
Expand Down
6 changes: 1 addition & 5 deletions extension/llm/export/partitioner_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,7 @@ def _validate_ios_version() -> None:
op_linear_quantizer_config=op_linear_quantizer_config,
)

# ExecuTorch does not build CoreML delegate runtime to handle state
# when using OSS scripts, so we define take_over_mutable_buffer = False,
# even when target is iOS18
# take_over_mutable_buffer = minimum_deployment_target >= ct.target.iOS18
take_over_mutable_buffer = False
take_over_mutable_buffer = minimum_deployment_target >= ct.target.iOS18
return CoreMLPartitioner( # pyre-fixme[16]
compile_specs=compile_specs,
take_over_mutable_buffer=take_over_mutable_buffer,
Expand Down
Loading