Skip to content

Commit 51279a4

Browse files
committed
up
1 parent a7fa6bd commit 51279a4

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

.ci/scripts/test_torchao_huggingface_checkpoints.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ MODEL_OUT=model.pte
5151
# Default to XNNPACK
5252
BACKEND_ARGS="-X --xnnpack-extended-ops"
5353
if [[ "$USE_TORCHAO_KERNELS" -eq 1 ]]; then
54-
BACKEND_ARGS="--torchao-kernels"
54+
BACKEND_ARGS="--use-torchao-kernels"
5555
fi
5656

5757
case "$MODEL_NAME" in

examples/models/llama/export_llama_lib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,17 +418,17 @@ def build_args_parser() -> argparse.ArgumentParser:
418418
help="Delegate more operators beyond DQLinear to the xnnpack backend. Requires -X or --xnnpack to be set.",
419419
)
420420
parser.add_argument(
421-
"--torchao-kernels",
421+
"--use-torchao-kernels",
422422
action="store_true",
423423
help="Delegate tied-embedding and quantized linear ops to torchao kernels",
424424
)
425425
parser.add_argument(
426-
"--torchao-kernels-tied-embedding",
426+
"--use-torchao-kernels-tied-embedding",
427427
action="store_true",
428428
help="Delegate tied-embedding ops to torchao kernels",
429429
)
430430
parser.add_argument(
431-
"--torchao-kernels-linear",
431+
"--use-torchao-kernels-linear",
432432
action="store_true",
433433
help="Delegate linear ops to torchao kernels",
434434
)
@@ -756,7 +756,7 @@ def _prepare_for_llama_export(llm_config: LlmConfig) -> LLMEdgeManager:
756756
preq_group_size=llm_config.base.preq_group_size,
757757
preq_embedding_quantize=llm_config.base.preq_embedding_quantize,
758758
local_global_attention=llm_config.model.local_global_attention,
759-
use_torchao_kernels_linear=llm_config.backend.torchao.convert_linear,
759+
use_torchao_kernels_linear=llm_config.backend.torchao.use_torchao_kernels_linear,
760760
use_torchao_kernels_tied_embedding=llm_config.backend.torchao.convert_tied_embedding,
761761
)
762762
)

extension/llm/export/config/llm_config.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,8 @@ class TorchAOKernelsConfig:
458458
Configures the torchao-kernels backend.
459459
"""
460460

461-
convert_linear: bool = False
462-
convert_tied_embedding: bool = False
461+
use_torchao_kernels_linear: bool = False
462+
use_torchao_kernels_tied_embedding: bool = False
463463

464464

465465
@dataclass
@@ -647,22 +647,22 @@ def from_args(cls, args: argparse.Namespace) -> "LlmConfig": # noqa: C901
647647
if any(
648648
hasattr(args, a)
649649
for a in [
650-
"torchao_kernels",
651-
"torchao_kernels_linear",
652-
"torchao_kernels_tied_embedding",
650+
"use_torchao_kernels",
651+
"use_torchao_kernels_linear",
652+
"use_torchao_kernels_tied_embedding",
653653
]
654654
):
655-
if hasattr(args, "torchao_kernels") and args.torchao_kernels:
655+
if hasattr(args, "use_torchao_kernels") and args.torchao_kernels:
656656
# Enable all conversions if torchao_kernels is specified
657-
llm_config.backend.torchao.convert_linear = True
658-
llm_config.backend.torchao.convert_tied_embedding = True
657+
llm_config.backend.torchao.use_torchao_kernels_linear = True
658+
llm_config.backend.torchao.use_torchao_kernels_tied_embedding = True
659659
else:
660660
# Otherwise, only enable the conversions that are specified
661-
llm_config.backend.torchao.convert_linear = getattr(
662-
args, "torchao_kernels_linear", False
661+
llm_config.backend.torchao.use_torchao_kernels_linear = getattr(
662+
args, "use_torchao_kernels_linear", False
663663
)
664-
llm_config.backend.torchao.convert_tied_embedding = getattr(
665-
args, "torchao_kernels_tied_embedding", False
664+
llm_config.backend.torchao.use_torchao_kernels_tied_embedding = getattr(
665+
args, "use_torchao_kernels_tied_embedding", False
666666
)
667667

668668
# DebugConfig

0 commit comments

Comments
 (0)