-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update on "Move QAT out of prototype"
**Summary:** Move QAT out of prototype so we can provide stronger BC guarantees moving forward. **BC-breaking notes** Before: ``` from torchao.quantization.prototype.qat import ( disable_4w_fake_quant, disable_8da4w_fake_quant, enable_4w_fake_quant, enable_8da4w_fake_quant, ComposableQATQuantizer, Int4WeightOnlyQATQuantizer, Int4WeightOnlyEmbeddingQATQuantizer Int8DynActInt4WeightQATQuantizer, Int8DynActInt4WeightQATLinear, ) from torchao.quantization.prototype.qat.api import ( FakeQuantizeConfig, ) from torchao.quantization.prototype.qat.fake_quantizer import ( FakeQuantizer, ) ``` After: ``` from torchao.quantization.qat import ( ComposableQATQuantizer, Int4WeightOnlyQATQuantizer, Int4WeightOnlyEmbeddingQATQuantizer Int8DynActInt4WeightQATQuantizer, ) from torchao.quantization.qat.linear import ( disable_4w_fake_quant, disable_8da4w_fake_quant, enable_4w_fake_quant, enable_8da4w_fake_quant, Int8DynActInt4WeightQATLinear, ) from torchao.quantization.qat.api import ( FakeQuantizeConfig, ) from torchao.quantization.qat.fake_quantizer import ( FakeQuantizer, ) ``` **Test Plan:** python test/quantization/test_qat.py [ghstack-poisoned]
- Loading branch information
Showing
8 changed files
with
349 additions
and
175 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# From https://github.com/pytorch/test-infra/wiki/Using-Nova-Reusable-Build-Workflows | ||
name: Build AARCH64 Linux Wheels | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- build/packaging/** | ||
- .github/workflows/build_wheels_aarch64_linux.yml | ||
- setup.py | ||
push: | ||
branches: | ||
- nightly | ||
- main | ||
- release/* | ||
tags: | ||
# NOTE: Binary build pipelines should only get triggered on release candidate builds | ||
# Release candidate tags look like: v1.11.0-rc1 | ||
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | ||
schedule: | ||
- cron: '0 0 * * *' # Runs at midnight UTC every day | ||
workflow_dispatch: | ||
|
||
jobs: | ||
generate-matrix: | ||
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main | ||
with: | ||
package-type: wheel | ||
os: linux-aarch64 | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
with-cuda: disable | ||
|
||
build: | ||
needs: generate-matrix | ||
permissions: | ||
id-token: write | ||
contents: read | ||
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main | ||
with: | ||
# Set the ref to an empty string instead of the default nightly because | ||
# torchao doesn't have nightly branch setup yet, instead the build is | ||
# triggered daily from main with a schedule | ||
repository: pytorch/ao | ||
ref: "" | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
env-var-script: packaging/env_var_script_linux.sh | ||
pre-script: packaging/pre_build_script.sh | ||
# post-script: packaging/post_build_script.sh | ||
smoke-test-script: packaging/smoke_test.py | ||
package-name: torchao | ||
trigger-event: ${{ github.event_name }} | ||
architecture: aarch64 | ||
setup-miniconda: false | ||
secrets: | ||
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Build Windows Wheels | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- build/packaging/** | ||
- .github/workflows/build_wheels_windows.yml | ||
- setup.py | ||
push: | ||
branches: | ||
- nightly | ||
- main | ||
- release/* | ||
tags: | ||
# NOTE: Binary build pipelines should only get triggered on release candidate builds | ||
# Release candidate tags look like: v1.11.0-rc1 | ||
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | ||
schedule: | ||
- cron: '0 0 * * *' # Runs at midnight UTC every day | ||
workflow_dispatch: | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
generate-matrix: | ||
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main | ||
with: | ||
package-type: wheel | ||
os: windows | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
with-xpu: enable | ||
with-cuda: disable | ||
|
||
build: | ||
needs: generate-matrix | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/ao | ||
pre-script: packaging/pre_build_script.sh | ||
env-script: packaging/vc_env_helper.bat | ||
# post-script: "python packaging/wheel/relocate.py" | ||
smoke-test-script: packaging/smoke_test.py | ||
package-name: torchao | ||
name: ${{ matrix.repository }} | ||
uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main | ||
with: | ||
repository: ${{ matrix.repository }} | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
pre-script: ${{ matrix.pre-script }} | ||
env-script: ${{ matrix.env-script }} | ||
post-script: ${{ matrix.post-script }} | ||
package-name: ${{ matrix.package-name }} | ||
smoke-test-script: ${{ matrix.smoke-test-script }} | ||
trigger-event: ${{ github.event_name }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@echo on | ||
|
||
set VC_VERSION_LOWER=17 | ||
set VC_VERSION_UPPER=18 | ||
if "%VC_YEAR%" == "2019" ( set VC_VERSION_LOWER=16 set VC_VERSION_UPPER=17) | ||
if "%VC_YEAR%" == "2017" ( set VC_VERSION_LOWER=15 set VC_VERSION_UPPER=16) | ||
|
||
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do ( | ||
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" ( | ||
set "VS15INSTALLDIR=%%i" | ||
set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat" | ||
goto vswhere | ||
) | ||
) | ||
|
||
:vswhere | ||
if "%VSDEVCMD_ARGS%" == "" ( | ||
call "%VS15VCVARSALL%" x64 || exit /b 1 | ||
) else ( | ||
call "%VS15VCVARSALL%" x64 %VSDEVCMD_ARGS% || exit /b 1 | ||
) | ||
|
||
@echo on | ||
|
||
if "%CU_VERSION%" == "xpu" call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | ||
|
||
set DISTUTILS_USE_SDK=1 | ||
|
||
set args=%1 | ||
shift | ||
:start | ||
if [%1] == [] goto done | ||
set args=%args% %1 | ||
shift | ||
goto start | ||
|
||
:done | ||
if "%args%" == "" ( | ||
echo Usage: vc_env_helper.bat [command] [args] | ||
echo e.g. vc_env_helper.bat cl /c test.cpp | ||
) | ||
|
||
%args% || exit /b 1 |
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
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
Oops, something went wrong.