Skip to content

Bump torchao pin to enable dynamic shapes in lowbit #9555

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

Merged
merged 3 commits into from
Mar 24, 2025
Merged
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
1 change: 0 additions & 1 deletion .ci/scripts/test_llama_torchao_lowbit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ ${PYTHON_EXECUTABLE} -m examples.models.llama.export_llama \
-qmode "torchao:8da${QLINEAR_BITWIDTH}w" \
--group_size ${QLINEAR_GROUP_SIZE} \
-E "torchao:${QEMBEDDING_BITWIDTH},${QEMBEDDING_GROUP_SIZE}" \
--disable_dynamic_shape \
-d fp32

# Test run
Expand Down
3 changes: 1 addition & 2 deletions examples/models/llama/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ Please refer to [this tutorial](https://pytorch.org/executorch/main/llm/llama-de

## Running with low-bit kernels

We now give instructions for quantizating and running your model with low-bit kernels. These are still experimental, and require you do development on an Arm-based Mac. Also note that low-bit quantization often requires QAT (quantization-aware training) to give good quality results. Currently dynamic shapes must be disabled when exporting a model with these kernels.
We now give instructions for quantizating and running your model with low-bit kernels. These are still experimental, and require you do development on an Arm-based Mac. Also note that low-bit quantization often requires QAT (quantization-aware training) to give good quality results.

First export your model for lowbit quantization (step 2 above):

Expand All @@ -408,7 +408,6 @@ python -m examples.models.llama.export_llama \
-qmode "torchao:8da${QLINEAR_BITWIDTH}w" \
--group_size ${QLINEAR_GROUP_SIZE} \
-E "torchao:${QEMBEDDING_BITWIDTH},${QEMBEDDING_GROUP_SIZE}" \
--disable_dynamic_shape \
-d fp32
```

Expand Down
13 changes: 0 additions & 13 deletions examples/models/llama/export_llama_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,19 +699,6 @@ def _validate_args(args):
"Shared embedding is only supported with torchao quantization."
)

if (
args.quantization_mode is not None
and args.quantization_mode.startswith("torchao:")
) or (
args.embedding_quantize is not None
and args.embedding_quantize.startswith("torchao:")
):
if args.enable_dynamic_shape:
raise ValueError(
"Dynamic shape is not currently supported with torchao ops. Please use --disable_dynamic_shape."
"If you need this feature, please file an issue."
)


def _to_edge_and_lower_llama_xnnpack(
builder_exported,
Expand Down
Loading