Skip to content

PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度

Add AutoRound binary build and publish workflow (#1132)

chen, suyueb38f895e552f
diff --git a/.github/workflows/manual-binary-build-publish.yml b/.github/workflows/manual-binary-build-publish.yml
new file mode 100644
index 000000000..479707409
--- /dev/null
+++ b/.github/workflows/manual-binary-build-publish.yml
@@ -0,0 +1,63 @@
+name: AutoRound binary build and publish
+permissions:
+ contents: read
+
+on:
+ workflow_dispatch:
+ inputs:
+ branch:
+ default: 'v0.9.3'
+ description: 'Tag to build the binary'
+ required: true
+ type: string
+ publish:
+ default: false
+ description: 'Publish the binary to PyPi'
+ required: false
+ type: boolean
+
+jobs:
+ binary-build-and-publish:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ option: ["full", "lib", "hpu"]
+ fail-fast: true
+ steps:
+ - name: Checkout out Repo
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.branch }}
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.12'
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip setuptools wheel
+
+ - name: Build the binary
+ run: |
+ if [ "${{ matrix.option }}" == "full" ]; then
+ echo "Building auto-round binary..."
+ python setup.py sdist bdist_wheel
+ else
+ echo "Building auto-round-${{ matrix.option }} binary..."
+ python setup.py sdist bdist_wheel ${{ matrix.option }}
+ fi
+
+ - name: Publish the binary
+ if: ${{ fromJSON(inputs.publish) }}
+ env:
+ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
+ working-directory: ./${{ matrix.repo }}
+ run: |
+ python -m pip install --upgrade twine
+ # python -m twine upload dist/*
+
+ - uses: actions/[email protected]
+ with:
+ name: dist-${{ matrix.option }}
+ path: dist
diff --git a/setup.py b/setup.py
index 175ef5eed..d0d5ec397 100644
--- a/setup.py
+++ b/setup.py
@@ -107,9 +107,8 @@ PKG_INSTALL_CFG = {
],
),
"install_requires": fetch_requirements("requirements.txt"),
- "extras_require": {
- "cpu": fetch_requirements("requirements-cpu.txt"),
- },
+ # auto-round[cpu] is deprecated, will be removed from v1.0.0
+ "extras_require": {"cpu": fetch_requirements("requirements-cpu.txt"), "kernel": ["auto-round-kernel"]},
}
###############################################################################
@@ -135,9 +134,12 @@ LIB_INSTALL_CFG = {
}
if __name__ == "__main__":
+
+ package_name = "auto_round"
# There are two ways to install hpu-only package:
# 1. python setup.py lib install
# 2. Within the gaudi docker where the HPU is available, we install the "auto_round_lib" by default.
+ # 3. This package is deprecated and will be removed from v1.0.0 release, please replace with auto_round_hpu.
is_user_requesting_library_build = "lib" in sys.argv
if is_user_requesting_library_build:
sys.argv.remove("lib")
@@ -145,17 +147,15 @@ if __name__ == "__main__":
if should_build_library:
package_name = "auto_round_lib"
- # Install hpu dependencies when hpu is build args, and keep "auto_round" package name.
- # Only available for source code installation, "python setup.py install hpu".
+ # From v0.9.3, auto-round-hpu will be published to replace auto-round-lib.
hpu_build = "hpu" in sys.argv
if hpu_build:
sys.argv.remove("hpu")
- package_name = "auto_round"
+ package_name = "auto_round_hpu"
if should_build_library or hpu_build:
INSTALL_CFG = LIB_INSTALL_CFG
else:
- package_name = "auto_round"
INSTALL_CFG = PKG_INSTALL_CFG
include_packages = INSTALL_CFG.get("include_packages", {})