Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into aqt_refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jainapurva committed Nov 13, 2024
2 parents 9427064 + 39f16f4 commit 82477b9
Show file tree
Hide file tree
Showing 33 changed files with 1,603 additions and 157 deletions.
64 changes: 57 additions & 7 deletions .github/workflows/ruff_linter.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Code Analysis with Ruff

on:
workflow_dispatch:
inputs:
pr_url:
description: 'URL of the PR to fix'
required: true
type: string
push:
branches:
- main
Expand All @@ -13,30 +19,74 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

strategy:
matrix:
python-version: ["3.9"]
steps:
- name: Extract PR info
if: github.event_name == 'workflow_dispatch'
run: |
PR_URL=${{ github.event.inputs.pr_url }}
PR_NUMBER=$(echo $PR_URL | grep -oE '[0-9]+$')
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
- uses: actions/checkout@v3
if: github.event_name == 'workflow_dispatch'
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout PR branch
if: github.event_name == 'workflow_dispatch'
run: |
gh pr checkout ${{ env.PR_NUMBER }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3
if: github.event_name != 'workflow_dispatch'
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff==0.6.8
- name: Analyzing the code with ruff
- name: Regular lint check
if: github.event_name != 'workflow_dispatch'
run: |
ruff check .
- name: Check *all* Python files for F821, F823, and W191
run: |
# --isolated is used to skip the allowlist at all so this applies to all files
# please be careful when using this large changes means everyone needs to rebase
ruff check --isolated --select F821,F823,W191
- name: Check the allow-listed files for F,I
run: |
ruff check --select F,I
- name: Check the allow-listed files for well formatted code
run: |
ruff format --check
- name: Apply fixes to PR
if: github.event_name == 'workflow_dispatch'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Apply fixes
ruff check --select F,I --fix
ruff format .
# Commit and push if there are changes
if [[ -n "$(git status --porcelain)" ]]; then
git add .
git commit -m "Apply automatic Ruff fixes"
git push
else
echo "No fixes needed!"
fi
4 changes: 3 additions & 1 deletion docs/source/api_ref_dtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ torchao.dtypes

to_nf4
to_affine_quantized_intx
to_affine_quantized_floatx
to_affine_quantized_intx_static
to_affine_quantized_floatx
to_affine_quantized_floatx_static
to_affine_quantized_fpx
NF4Tensor
AffineQuantizedTensor

..
Expand Down
9 changes: 3 additions & 6 deletions docs/source/api_ref_intro.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
``torchao`` API Reference
=========================

This section introduces the torchao API reference.
Dive into the details of how torchao integrates with PyTorch to
optimize your machine learning models.
This section introduces the torchao API reference. Dive into the details of how torchao integrates with PyTorch to optimize your machine learning models.

.. toctree::
:glob:
:maxdepth: 1
:caption: Python API Reference

api_ref_sparsity
api_ref_quantization
api_ref_dtypes
api_ref_kernel
api_ref_quantization
api_ref_sparsity
38 changes: 31 additions & 7 deletions docs/source/api_ref_quantization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,39 @@ torchao.quantization
.. autosummary::
:toctree: generated/
:nosignatures:

SmoothFakeDynQuantMixin
SmoothFakeDynamicallyQuantizedLinear
swap_linear_with_smooth_fq_linear
smooth_fq_linear_to_inference
Int4WeightOnlyGPTQQuantizer
Int4WeightOnlyQuantizer
autoquant

quantize_
int8_dynamic_activation_int4_weight
int8_dynamic_activation_int8_weight
int4_weight_only
int8_weight_only
float8_weight_only
float8_dynamic_activation_float8_weight
float8_static_activation_float8_weight
uintx_weight_only
fpx_weight_only

to_linear_activation_quantized

swap_linear_with_smooth_fq_linear
smooth_fq_linear_to_inference

choose_qparams_affine
choose_qparams_affine_with_min_max
choose_qparams_affine_floatx
quantize_affine
quantize_affine_floatx
dequantize_affine
dequantize_affine_floatx
choose_qparams_and_quantize_affine_hqq
fake_quantize_affine
fake_quantize_affine_cachemask

safe_int_mm
int_scaled_matmul

MappingType
ZeroPointDomain
TorchAODType

Loading

0 comments on commit 82477b9

Please sign in to comment.