Enable autoquant API for CPU #2618
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run TorchAO Experimental Tests | |
on: | |
push: | |
branches: | |
- main | |
- 'gh/**' | |
pull_request: | |
branches: | |
- main | |
- 'gh/**' | |
jobs: | |
test-cpu-ops: | |
strategy: | |
matrix: | |
runner: [macos-14] | |
runs-on: ${{matrix.runner}} | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup environment | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: "3.10" | |
miniconda-version: "latest" | |
activate-environment: venv | |
- name: Install requirements | |
run: | | |
conda activate venv | |
# Install executorch first because it installs its own version | |
# of torch and torchao, which we do not want to use | |
pip install executorch | |
pip install torch --index-url "https://download.pytorch.org/whl/nightly/cpu" --force-reinstall | |
pip install numpy | |
pip install pytest | |
pip install parameterized | |
USE_CPP=1 pip install . | |
- name: Run python tests | |
run: | | |
conda activate venv | |
pytest torchao/experimental/tests/test_int8_dynamic_activation_intx_weight.py | |
python torchao/experimental/tests/test_embedding_xbit_quantizer.py | |
- name: Run kernels/cpu/aarch64/tests | |
run: | | |
conda activate venv | |
pushd torchao/experimental/kernels/cpu/aarch64/tests | |
sh build_and_run_tests.sh | |
rm -rf /tmp/cmake-out | |
popd | |
- name: Run torchao/experimental/ops/tests | |
run: | | |
conda activate venv | |
pushd torchao/experimental/ops/tests | |
sh build_and_run_tests.sh | |
rm -rf /tmp/cmake-out | |
popd | |
- name: ET ops build | |
run: | | |
conda activate venv | |
pushd torchao/experimental | |
sh build_torchao_ops.sh executorch | |
popd | |
test-mps-ops: | |
strategy: | |
matrix: | |
runner: [macos-m1-stable] | |
runs-on: ${{matrix.runner}} | |
steps: | |
- name: Print machine info | |
run: | | |
uname -a | |
if [ $(uname -s) == Darwin ]; then | |
sysctl machdep.cpu.brand_string | |
sysctl machdep.cpu.core_count | |
fi | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Create conda env | |
run: | | |
conda create -yn test-mps-ops-env python=3.11 | |
- name: Activate conda env | |
run: | | |
source activate base | |
conda activate test-mps-ops-env | |
- name: Install torch | |
run: | | |
pip install torch --index-url "https://download.pytorch.org/whl/nightly/cpu" | |
- name: Print torch version | |
run: | | |
python -c "import torch; print(torch.__version__)" | |
- name: Install requirements | |
run: | | |
pip install cmake | |
pip install parameterized | |
pip install pyyaml | |
pip install numpy | |
- name: Print pip freeze | |
run: | | |
pip freeze | |
- name: Print current directory | |
run: | | |
python -c "import os; print(os.getcwd())" | |
- name: Build ao with experimental mps ops | |
run: | | |
USE_CPP=1 TORCHAO_BUILD_EXPERIMENTAL_MPS=1 pip install . | |
- name: Run mps tests | |
run: | | |
pushd torchao/experimental/ops/mps/test | |
python test_lowbit.py | |
python test_quantizer.py | |
popd |