mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
update test_quantization tests to run weekly (#163077)
Fixes #162854 Pull Request resolved: https://github.com/pytorch/pytorch/pull/163077 Approved by: https://github.com/huydhn
This commit is contained in:
committed by
PyTorch MergeBot
parent
141fc7276e
commit
3b73841f43
@ -59,7 +59,7 @@ test_python_shard() {
|
||||
|
||||
setup_test_python
|
||||
|
||||
time python test/run_test.py --verbose --exclude-jit-executor --exclude-distributed-tests --shard "$1" "$NUM_TEST_SHARDS"
|
||||
time python test/run_test.py --verbose --exclude-jit-executor --exclude-distributed-tests --exclude-quantization-tests --shard "$1" "$NUM_TEST_SHARDS"
|
||||
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
@ -322,14 +322,14 @@ test_python_shard() {
|
||||
|
||||
# modify LD_LIBRARY_PATH to ensure it has the conda env.
|
||||
# This set of tests has been shown to be buggy without it for the split-build
|
||||
time python test/run_test.py --exclude-jit-executor --exclude-distributed-tests $INCLUDE_CLAUSE --shard "$1" "$NUM_TEST_SHARDS" --verbose $PYTHON_TEST_EXTRA_OPTION --upload-artifacts-while-running
|
||||
time python test/run_test.py --exclude-jit-executor --exclude-distributed-tests --exclude-quantization-tests $INCLUDE_CLAUSE --shard "$1" "$NUM_TEST_SHARDS" --verbose $PYTHON_TEST_EXTRA_OPTION --upload-artifacts-while-running
|
||||
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
test_python() {
|
||||
# shellcheck disable=SC2086
|
||||
time python test/run_test.py --exclude-jit-executor --exclude-distributed-tests $INCLUDE_CLAUSE --verbose $PYTHON_TEST_EXTRA_OPTION
|
||||
time python test/run_test.py --exclude-jit-executor --exclude-distributed-tests --exclude-quantization-tests $INCLUDE_CLAUSE --verbose $PYTHON_TEST_EXTRA_OPTION
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
@ -390,6 +390,7 @@ test_dynamo_wrapped_shard() {
|
||||
--exclude-distributed-tests \
|
||||
--exclude-torch-export-tests \
|
||||
--exclude-aot-dispatch-tests \
|
||||
--exclude-quantization-tests \
|
||||
--shard "$1" "$NUM_TEST_SHARDS" \
|
||||
--verbose \
|
||||
--upload-artifacts-while-running
|
||||
@ -1162,6 +1163,12 @@ test_distributed() {
|
||||
fi
|
||||
}
|
||||
|
||||
test_quantization() {
|
||||
echo "Testing quantization"
|
||||
|
||||
python test/test_quantization.py
|
||||
}
|
||||
|
||||
test_rpc() {
|
||||
echo "Testing RPC C++ tests"
|
||||
# NB: the ending test_rpc must match the current function name for the current
|
||||
@ -1655,6 +1662,8 @@ elif [[ "${TEST_CONFIG}" == *executorch* ]]; then
|
||||
test_executorch
|
||||
elif [[ "$TEST_CONFIG" == 'jit_legacy' ]]; then
|
||||
test_python_legacy_jit
|
||||
elif [[ "$TEST_CONFIG" == 'quantization' ]]; then
|
||||
test_quantization
|
||||
elif [[ "${BUILD_ENVIRONMENT}" == *libtorch* ]]; then
|
||||
# TODO: run some C++ tests
|
||||
echo "no-op at the moment"
|
||||
|
@ -25,7 +25,7 @@ echo Copying over test times file
|
||||
robocopy /E "%PYTORCH_FINAL_PACKAGE_DIR_WIN%\.additional_ci_files" "%PROJECT_DIR_WIN%\.additional_ci_files"
|
||||
|
||||
echo Run nn tests
|
||||
python run_test.py --exclude-jit-executor --exclude-distributed-tests --shard "%SHARD_NUMBER%" "%NUM_TEST_SHARDS%" --verbose
|
||||
python run_test.py --exclude-jit-executor --exclude-distributed-tests --exclude-quantization-tests --shard "%SHARD_NUMBER%" "%NUM_TEST_SHARDS%" --verbose
|
||||
if ERRORLEVEL 1 goto fail
|
||||
|
||||
popd
|
||||
|
1
.github/pytorch-probot.yml
vendored
1
.github/pytorch-probot.yml
vendored
@ -19,6 +19,7 @@ ciflow_push_tags:
|
||||
- ciflow/nightly
|
||||
- ciflow/periodic
|
||||
- ciflow/periodic-rocm-mi300
|
||||
- ciflow/quantization-periodic
|
||||
- ciflow/rocm
|
||||
- ciflow/rocm-mi300
|
||||
- ciflow/s390
|
||||
|
54
.github/workflows/quantization-periodic.yml
vendored
Normal file
54
.github/workflows/quantization-periodic.yml
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
name: quantization-periodic
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- ciflow/quantization-periodic/*
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# run weekly
|
||||
- cron: "45 0 * * 0"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
get-default-label-prefix:
|
||||
name: get-default-label-prefix
|
||||
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
|
||||
if: ${{ (github.event_name != 'schedule' || github.repository == 'pytorch/pytorch') && github.repository_owner == 'pytorch' }}
|
||||
with:
|
||||
triggering_actor: ${{ github.triggering_actor }}
|
||||
issue_owner: ${{ github.event.pull_request.user.login || github.event.issue.user.login }}
|
||||
curr_branch: ${{ github.head_ref || github.ref_name }}
|
||||
curr_ref_type: ${{ github.ref_type }}
|
||||
opt_out_experiments: lf
|
||||
|
||||
periodic-quantization-build:
|
||||
name: periodic-quantization-build
|
||||
uses: ./.github/workflows/_linux-build.yml
|
||||
needs: get-default-label-prefix
|
||||
with:
|
||||
runner_prefix: "${{ needs.get-default-label-prefix.outputs.label-type }}"
|
||||
build-environment: linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
||||
docker-image-name: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
||||
cuda-arch-list: '8.9'
|
||||
test-matrix: |
|
||||
{ include: [
|
||||
{ config: "quantization", shard: 1, num_shards: 1, runner: "${{ needs.get-default-label-prefix.outputs.label-type }}linux.g6.4xlarge.experimental.nvidia.gpu" },
|
||||
]}
|
||||
secrets: inherit
|
||||
periodic-test-quantization:
|
||||
name: periodic-test-quantization
|
||||
uses: ./.github/workflows/_linux-test.yml
|
||||
needs: periodic-quantization-build
|
||||
with:
|
||||
build-environment: linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
||||
docker-image: ${{ needs.periodic-quantization-build.outputs.docker-image }}
|
||||
test-matrix: ${{ needs.periodic-quantization-build.outputs.test-matrix }}
|
||||
secrets: inherit
|
@ -4,6 +4,8 @@ import copy
|
||||
import unittest
|
||||
from collections import Counter
|
||||
|
||||
from packaging import version
|
||||
|
||||
import torch
|
||||
from torch.ao.quantization import (
|
||||
compare_results,
|
||||
@ -29,6 +31,10 @@ from torch.testing._internal.common_utils import (
|
||||
)
|
||||
|
||||
|
||||
if version.parse(torch.__version__) >= version.parse("2.8.0"):
|
||||
torch._dynamo.config.cache_size_limit = 128
|
||||
|
||||
|
||||
@unittest.skipIf(IS_WINDOWS, "Windows not yet supported for torch.compile")
|
||||
class TestNumericDebugger(TestCase):
|
||||
def _assert_each_node_has_debug_handle(self, model) -> None:
|
||||
|
@ -2121,14 +2121,9 @@ class TestQuantizePT2E(PT2EQuantizationTestCase):
|
||||
m(*example_inputs)
|
||||
|
||||
def test_observer_callback(self):
|
||||
from torch.library import impl, Library
|
||||
from torch.library import custom_op
|
||||
|
||||
test_lib = Library("test_int4", "DEF") # noqa: TOR901
|
||||
test_lib.define(
|
||||
"quantize_per_tensor_int4(Tensor input, float scale, int zero_point) -> Tensor"
|
||||
)
|
||||
|
||||
@impl(test_lib, "quantize_per_tensor_int4", "CompositeExplicitAutograd")
|
||||
@custom_op("test_int4::quantize_per_tensor_int4", mutates_args=())
|
||||
def quantize_per_tensor_int4(
|
||||
input: torch.Tensor,
|
||||
scale: float,
|
||||
@ -2141,11 +2136,7 @@ class TestQuantizePT2E(PT2EQuantizationTestCase):
|
||||
.view(torch.bits8)
|
||||
)
|
||||
|
||||
test_lib.define(
|
||||
"dequantize_per_tensor_int4(Tensor input, float scale, int zero_point) -> Tensor"
|
||||
)
|
||||
|
||||
@impl(test_lib, "dequantize_per_tensor_int4", "CompositeExplicitAutograd")
|
||||
@custom_op("test_int4::dequantize_per_tensor_int4", mutates_args=())
|
||||
def dequantize_per_tensor_int4(
|
||||
input: torch.Tensor,
|
||||
scale: float,
|
||||
|
@ -400,6 +400,7 @@ AOT_DISPATCH_TESTS = [
|
||||
]
|
||||
FUNCTORCH_TESTS = [test for test in TESTS if test.startswith("functorch")]
|
||||
ONNX_TESTS = [test for test in TESTS if test.startswith("onnx")]
|
||||
QUANTIZATION_TESTS = [test for test in TESTS if test.startswith("test_quantization")]
|
||||
|
||||
|
||||
def _is_cpp_test(test):
|
||||
@ -1470,6 +1471,11 @@ def parse_args():
|
||||
action="store_true",
|
||||
help="exclude inductor tests",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--exclude-quantization-tests",
|
||||
action="store_true",
|
||||
help="exclude quantization tests",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--dry-run",
|
||||
action="store_true",
|
||||
@ -1643,6 +1649,9 @@ def get_selected_tests(options) -> list[str]:
|
||||
if options.exclude_aot_dispatch_tests:
|
||||
options.exclude.extend(AOT_DISPATCH_TESTS)
|
||||
|
||||
if options.exclude_quantization_tests:
|
||||
options.exclude.extend(QUANTIZATION_TESTS)
|
||||
|
||||
# these tests failing in CUDA 11.6 temporary disabling. issue https://github.com/pytorch/pytorch/issues/75375
|
||||
if torch.version.cuda is not None:
|
||||
options.exclude.extend(["distributions/test_constraints"])
|
||||
|
Reference in New Issue
Block a user