Skip to content

Commit a9ae56a

Browse files
committed
Update on "Use llm_config instead of args in export_llama functions"
Differential Revision: [D75263988](https://our.internmc.facebook.com/intern/diff/D75263988) [ghstack-poisoned]
2 parents 79d8d24 + 93fe7b9 commit a9ae56a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

examples/models/llama/export_llama_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ def _export_llama(llm_config, args) -> LLMEdgeManager: # noqa: C901
11071107
use_kv_cache=llm_config.model.use_kv_cache,
11081108
embedding_quantize=llm_config.quantization.embedding_quantize,
11091109
pt2e_quantize=llm_config.quantization.pt2e_quantize,
1110-
coreml_ios=llm_config.backend.coreml.ios_version,
1110+
coreml_ios=llm_config.backend.coreml.ios,
11111111
coreml_quantize=llm_config.backend.coreml.quantize,
11121112
coreml_compute_units=llm_config.backend.coreml.compute_units,
11131113
use_qnn_sha=llm_config.backend.qnn.use_sha,

examples/models/llama/tests/test_export_llama_lib.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import unittest
88

99
from executorch.devtools.backend_debug import get_delegation_info
10+
from executorch.examples.models.llama.config.llm_config import LlmConfig
1011
from executorch.examples.models.llama.export_llama_lib import (
1112
_export_llama,
1213
build_args_parser,
@@ -34,13 +35,20 @@ def test_has_expected_ops_and_op_counts(self):
3435
# we cannot test quantization args in this way
3536
# since quantization requires promoting meta tensors
3637
# to device=cpu, which requires real weights.
38+
39+
llm_config = LlmConfig()
40+
llm_config.model.use_sdpa_with_kv_cache = True
41+
llm_config.model.use_kv_cache = True
42+
llm_config.debug.verbose = True
43+
44+
# We still need args for backward compatibility during transition
3745
parser = build_args_parser()
3846
args = parser.parse_args([])
3947
args.use_sdpa_with_kv_cache = True
4048
args.use_kv_cache = True
4149
args.verbose = True
4250

43-
builder = _export_llama(args)
51+
builder = _export_llama(llm_config, args)
4452
graph_module = builder.edge_manager.exported_program().graph_module
4553
delegation_info = get_delegation_info(graph_module)
4654

0 commit comments

Comments
 (0)