Skip to content

Commit 498f052

Browse files
authored
Merge branch 'pytorch:main' into quant/int4/wo/0
2 parents 06c77d1 + ca99c1c commit 498f052

File tree

77 files changed

+3203
-2786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3203
-2786
lines changed

.github/pytorch-probot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ ciflow_push_tags:
44
- ciflow/tutorials
55
- ciflow/rocm
66
- ciflow/4xh100
7+
- ciflow/xpu

.github/scripts/ci_test_xpu.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
conda create -yn xpu_ao_ci python=3.10
4+
source activate xpu_ao_ci
5+
6+
export CC=/usr/bin/gcc
7+
export CXX=/usr/bin/g++
8+
export SCCACHE_DISABLE=1
9+
10+
python3 -m pip install torch torchvision torchaudio pytorch-triton-xpu --index-url https://download.pytorch.org/whl/nightly/xpu --force-reinstall --no-cache-dir
11+
cd torchao && pip install . --no-build-isolation && cd ..
12+
13+
python3 -c "import torch; import torchao; print(f'Torch version: {torch.__version__}')"
14+
15+
pip install pytest expecttest parameterized accelerate hf_transfer 'modelscope!=1.15.0'
16+
17+
pytest -v -s torchao/test/quantization/quantize_/workflows/int4/test_int4_plain_int32_tensor.py
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD 3-Clause license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
#!/bin/bash
8+
set -e
9+
source eval_env_checks.sh
10+
check_lmms_eval
11+
12+
usage() {
13+
echo "Usage: $0 --model_id <model_id> --model_type <model_type> [--tasks <tasks> (comma-separated, e.g. mmlu,arc_challenge, default mmlu)] [--use_cache]"
14+
exit 1
15+
}
16+
17+
MODEL_ID_ARRAY=()
18+
MODEL_TYPE=""
19+
TASK_ARRAY=("chartqa") # default can be overwritten by user input
20+
BATCH_SIZE=1
21+
USE_CACHE=false # default: do not use cache
22+
# Parse arguments
23+
while [[ $# -gt 0 ]]; do
24+
case "$1" in
25+
--model_ids)
26+
shift
27+
while [[ $# -gt 0 && ! "$1" =~ ^-- ]]; do
28+
MODEL_ID_ARRAY+=("$1")
29+
shift
30+
done
31+
;;
32+
--model_type)
33+
MODEL_TYPE="$2"
34+
shift 2
35+
;;
36+
--batch_size)
37+
BATCH_SIZE="$2"
38+
shift 2
39+
;;
40+
--tasks)
41+
shift
42+
TASK_ARRAY=()
43+
while [[ $# -gt 0 && ! "$1" =~ ^-- ]]; do
44+
TASK_ARRAY+=("$1")
45+
shift
46+
done
47+
;;
48+
--use_cache)
49+
USE_CACHE=true
50+
shift
51+
;;
52+
*)
53+
echo "Unknown argument: $1"
54+
usage
55+
exit 1
56+
;;
57+
esac
58+
done
59+
if [[ ${#MODEL_ID_ARRAY[@]} -eq 0 ]]; then
60+
echo "Error: --model_ids is required"
61+
usage
62+
exit 1
63+
fi
64+
if [[ -z "$MODEL_TYPE" ]]; then
65+
echo "Error: --model_type is required"
66+
usage
67+
exit 1
68+
fi
69+
RESULTS_DIR="$(pwd)/mm_quality_eval_results"
70+
for MODEL_ID in "${MODEL_ID_ARRAY[@]}"; do
71+
# Replace all '/' with '_'
72+
SAFE_MODEL_ID="${MODEL_ID//\//_}"
73+
echo "======================== Eval Multi-modal Model Quality $MODLE_ID ======================"
74+
for TASK in "${TASK_ARRAY[@]}"; do
75+
OUTPUT_FILE="$(pwd)/${SAFE_MODEL_ID}_mm_quality_${TASK}.log"
76+
EVAL_CACHE_DB_PREFIX="/tmp/${SAFE_MODEL_ID}_mm_quality_${TASK}"
77+
mkdir -p "${EVAL_CACHE_DB_PREFIX}"
78+
echo "Running multi-modal model quality (accuracy) evaluation for model $MODEL_ID on task $TASK"
79+
80+
MAIN_PORT=12356
81+
LMMS_EVAL_CMD="accelerate launch \
82+
--main_process_port \"$MAIN_PORT\" \
83+
-m lmms_eval \
84+
--model \"$MODEL_TYPE\" \
85+
--model_args \"pretrained=$MODEL_ID\" \
86+
--tasks \"$TASK\" \
87+
--batch_size \"$BATCH_SIZE\" \
88+
--output_path \"$RESULTS_DIR\""
89+
90+
if $USE_CACHE; then
91+
LMMS_EVAL_CMD="$LMMS_EVAL_CMD --use_cache \"$EVAL_CACHE_DB_PREFIX\""
92+
fi
93+
94+
eval "$LMMS_EVAL_CMD" > "$OUTPUT_FILE" 2>&1
95+
echo "Quality eval output for task '$TASK' saved to $OUTPUT_FILE"
96+
done
97+
echo "======================== Eval Model Quality $MODEL_ID End =================="
98+
done

.github/workflows/1xH100_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
pip install uv
4747
pip install ${{ matrix.torch-spec }}
4848
uv pip install -r dev-requirements.txt
49-
pip install .
49+
pip install . --no-build-isolation
5050
pytest test/integration --verbose -s
5151
pytest test/dtypes/test_affine_quantized_float.py --verbose -s
5252
python test/quantization/quantize_/workflows/float8/test_float8_tensor.py

.github/workflows/1xL4_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
pip install uv
4747
pip install ${{ matrix.torch-spec }}
4848
uv pip install -r dev-requirements.txt
49-
pip install .
49+
pip install . --no-build-isolation
5050
pytest test/integration --verbose -s
5151
pytest test/dtypes/test_affine_quantized_float.py --verbose -s
5252
./test/float8/test_everything_single_gpu.sh

.github/workflows/4xH100_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ jobs:
4444
pip install uv
4545
pip install ${{ matrix.torch-spec }}
4646
uv pip install -r dev-requirements.txt
47-
pip install .
47+
pip install . --no-build-isolation
4848
./test/float8/test_everything_multi_gpu.sh
4949
./test/prototype/mx_formats/test_mx_dtensor.sh

.github/workflows/build_wheels_linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- packaging/**
99
- .github/workflows/build_wheels_linux.yml
1010
- setup.py
11+
- .github/scripts/**
1112
push:
1213
branches:
1314
- nightly

.github/workflows/dashboard_perf_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
${CONDA_RUN} python -m pip install --upgrade pip
3131
${CONDA_RUN} pip install ${{ matrix.torch-spec }}
3232
${CONDA_RUN} pip install -r dev-requirements.txt
33-
${CONDA_RUN} pip install .
33+
${CONDA_RUN} pip install . --no-build-isolation
3434
# SAM 2.1
3535
${CONDA_RUN} pip install -r examples/sam2_amg_server/requirements.txt
3636

.github/workflows/doc_build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ jobs:
4343
- name: Install dependencies
4444
run: |
4545
python -m pip install torch
46-
python -m pip install setuptools==78.1.1 --force-reinstall
47-
python -m pip install -e .
46+
python -m pip install -e . --no-build-isolation
4847
pip install -r dev-requirements.txt
4948
python -m pip install -r docs/requirements.txt
5049
- name: Build docs

.github/workflows/nightly_smoke_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ jobs:
3838
python -m pip install --upgrade pip
3939
pip install ${{ matrix.torch-spec }}
4040
pip install -r dev-requirements.txt
41-
python setup.py install
41+
pip install . --no-build-isolation
4242
pytest test --verbose -s

0 commit comments

Comments
 (0)