Skip to content

Commit fa565ea

Browse files
committed
Setup TorchBench in Docker
This reduces the time spending to setup TorchBench in A100/H100 by another half an hour Signed-off-by: Huy Do <huydhn@gmail.com> ghstack-source-id: ff22872 ghstack-comment-id: 3086043340 Pull-Request: #158613 Signed-off-by: Huy Do <huydhn@gmail.com>
1 parent d36afac commit fa565ea

File tree

8 files changed

+38
-45
lines changed

8 files changed

+38
-45
lines changed

.ci/docker/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ case "$tag" in
276276
NINJA_VERSION=1.9.0
277277
TRITON=yes
278278
;;
279-
pytorch-linux-jammy-py3.9-gcc11-inductor-benchmarks)
279+
pytorch-linux-jammy-py3.9-gcc11-inductor-benchmarks)
280280
ANACONDA_PYTHON_VERSION=3.9
281281
GCC_VERSION=11
282282
VISION=yes

.ci/docker/common/install_inductor_benchmark_deps.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,35 @@ function install_timm() {
1515
commit=$(get_pinned_commit timm)
1616

1717
pip_install "git+https://github.com/huggingface/pytorch-image-models@${commit}"
18-
# Clean up
19-
conda_run pip uninstall -y torch torchvision triton
18+
}
19+
20+
function install_torchbench() {
21+
local commit
22+
commit=$(get_pinned_commit torchbench)
23+
git clone https://github.com/pytorch/benchmark torchbench
24+
pushd torchbench
25+
git checkout "$commit"
26+
27+
python install.py --continue_on_fail
28+
29+
# TODO (huydhn): transformers-4.44.2 added by https://github.com/pytorch/benchmark/pull/2488
30+
# is regressing speedup metric. This needs to be investigated further
31+
pip install transformers==4.38.1
32+
33+
echo "Print all dependencies after TorchBench is installed"
34+
python -mpip freeze
35+
popd
2036
}
2137

2238
# Pango is needed for weasyprint which is needed for doctr
2339
conda_install pango
40+
41+
# Stable packages are ok here, just to satisfy TorchBench check
42+
pip_install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
43+
44+
install_torchbench
2445
install_huggingface
2546
install_timm
47+
48+
# Clean up
49+
conda_run pip uninstall -y torch torchvision torchaudio triton

.ci/docker/requirements-ci.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ pwlf==2.2.1
361361
#Pinned versions: 2.2.1
362362
#test that import: test_sac_estimator.py
363363

364-
365364
# To build PyTorch itself
366365
packaging>=24.2
367366
pyyaml

.ci/docker/ubuntu-rocm/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ COPY ./common/install_inductor_benchmark_deps.sh install_inductor_benchmark_deps
9898
COPY ./common/common_utils.sh common_utils.sh
9999
COPY ci_commit_pins/huggingface.txt huggingface.txt
100100
COPY ci_commit_pins/timm.txt timm.txt
101+
COPY ci_commit_pins/torchbench.txt torchbench.txt
101102
RUN if [ -n "${INDUCTOR_BENCHMARKS}" ]; then bash ./install_inductor_benchmark_deps.sh; fi
102-
RUN rm install_inductor_benchmark_deps.sh common_utils.sh timm.txt huggingface.txt
103+
RUN rm install_inductor_benchmark_deps.sh common_utils.sh timm.txt huggingface.txt torchbench.txt
103104

104105
# (optional) Install non-default Ninja version
105106
ARG NINJA_VERSION

.ci/docker/ubuntu/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ COPY ./common/install_inductor_benchmark_deps.sh install_inductor_benchmark_deps
9898
COPY ./common/common_utils.sh common_utils.sh
9999
COPY ci_commit_pins/huggingface.txt huggingface.txt
100100
COPY ci_commit_pins/timm.txt timm.txt
101+
COPY ci_commit_pins/torchbench.txt torchbench.txt
101102
RUN if [ -n "${INDUCTOR_BENCHMARKS}" ]; then bash ./install_inductor_benchmark_deps.sh; fi
102-
RUN rm install_inductor_benchmark_deps.sh common_utils.sh timm.txt huggingface.txt
103+
RUN rm install_inductor_benchmark_deps.sh common_utils.sh timm.txt huggingface.txt torchbench.txt
103104

104105
ARG TRITON
105106
ARG TRITON_CPU

.ci/pytorch/common_utils.sh

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -258,30 +258,6 @@ function clone_pytorch_xla() {
258258
fi
259259
}
260260

261-
function checkout_install_torchbench() {
262-
local commit
263-
commit=$(get_pinned_commit torchbench)
264-
git clone https://github.com/pytorch/benchmark torchbench
265-
pushd torchbench
266-
git checkout "$commit"
267-
268-
if [ "$1" ]; then
269-
python install.py --continue_on_fail models "$@"
270-
else
271-
# Occasionally the installation may fail on one model but it is ok to continue
272-
# to install and test other models
273-
python install.py --continue_on_fail
274-
fi
275-
276-
# TODO (huydhn): transformers-4.44.2 added by https://github.com/pytorch/benchmark/pull/2488
277-
# is regressing speedup metric. This needs to be investigated further
278-
pip install transformers==4.38.1
279-
280-
echo "Print all dependencies after TorchBench is installed"
281-
python -mpip freeze
282-
popd
283-
}
284-
285261
function install_torchao() {
286262
local commit
287263
commit=$(get_pinned_commit torchao)

.ci/pytorch/test.sh

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,13 +1668,11 @@ elif [[ "${TEST_CONFIG}" == *timm* ]]; then
16681668
elif [[ "${TEST_CONFIG}" == cachebench ]]; then
16691669
install_torchaudio
16701670
install_torchvision
1671-
checkout_install_torchbench nanogpt BERT_pytorch resnet50 hf_T5 llama moco
1672-
PYTHONPATH=$(pwd)/torchbench test_cachebench
1671+
PYTHONPATH=/torchbench test_cachebench
16731672
elif [[ "${TEST_CONFIG}" == verify_cachebench ]]; then
16741673
install_torchaudio
16751674
install_torchvision
1676-
checkout_install_torchbench nanogpt
1677-
PYTHONPATH=$(pwd)/torchbench test_verify_cachebench
1675+
PYTHONPATH=/torchbench test_verify_cachebench
16781676
elif [[ "${TEST_CONFIG}" == *torchbench* ]]; then
16791677
install_torchaudio
16801678
install_torchvision
@@ -1683,28 +1681,22 @@ elif [[ "${TEST_CONFIG}" == *torchbench* ]]; then
16831681
# https://github.com/opencv/opencv-python/issues/885
16841682
pip_install opencv-python==4.8.0.74
16851683
if [[ "${TEST_CONFIG}" == *inductor_torchbench_smoketest_perf* ]]; then
1686-
checkout_install_torchbench hf_Bert hf_Albert timm_vision_transformer
1687-
PYTHONPATH=$(pwd)/torchbench test_inductor_torchbench_smoketest_perf
1684+
PYTHONPATH=/torchbench test_inductor_torchbench_smoketest_perf
16881685
elif [[ "${TEST_CONFIG}" == *inductor_torchbench_cpu_smoketest_perf* ]]; then
1689-
checkout_install_torchbench timm_vision_transformer phlippe_densenet basic_gnn_edgecnn \
1690-
llama_v2_7b_16h resnet50 timm_efficientnet mobilenet_v3_large timm_resnest \
1691-
functorch_maml_omniglot yolov3 mobilenet_v2 resnext50_32x4d densenet121 mnasnet1_0
1692-
PYTHONPATH=$(pwd)/torchbench test_inductor_torchbench_cpu_smoketest_perf
1686+
PYTHONPATH=/torchbench test_inductor_torchbench_cpu_smoketest_perf
16931687
elif [[ "${TEST_CONFIG}" == *torchbench_gcp_smoketest* ]]; then
1694-
checkout_install_torchbench
1695-
TORCHBENCHPATH=$(pwd)/torchbench test_torchbench_gcp_smoketest
1688+
TORCHBENCHPATH=/torchbench test_torchbench_gcp_smoketest
16961689
else
1697-
checkout_install_torchbench
16981690
# Do this after checkout_install_torchbench to ensure we clobber any
16991691
# nightlies that torchbench may pull in
17001692
if [[ "${TEST_CONFIG}" != *cpu* ]]; then
17011693
install_torchrec_and_fbgemm
17021694
fi
1703-
PYTHONPATH=$(pwd)/torchbench test_dynamo_benchmark torchbench "$id"
1695+
PYTHONPATH=/torchbench test_dynamo_benchmark torchbench "$id"
17041696
fi
17051697
elif [[ "${TEST_CONFIG}" == *inductor_cpp_wrapper* ]]; then
17061698
install_torchvision
1707-
PYTHONPATH=$(pwd)/torchbench test_inductor_cpp_wrapper_shard "$SHARD_NUMBER"
1699+
PYTHONPATH=/torchbench test_inductor_cpp_wrapper_shard "$SHARD_NUMBER"
17081700
if [[ "$SHARD_NUMBER" -eq "1" ]]; then
17091701
test_inductor_aoti
17101702
fi

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy