Skip to content

Commit 663a5cc

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

File tree

6 files changed

+24
-34
lines changed

6 files changed

+24
-34
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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,28 @@ function install_timm() {
1919
conda_run pip uninstall -y torch torchvision triton
2020
}
2121

22+
function install_torchbench() {
23+
local commit
24+
commit=$(get_pinned_commit torchbench)
25+
git clone https://github.com/pytorch/benchmark torchbench
26+
pushd torchbench
27+
git checkout "$commit"
28+
29+
# Stable packages are ok here, just to satify TorchBench check
30+
pip_install torch torchvision torchaudio
31+
python install.py --continue_on_fail
32+
33+
# TODO (huydhn): transformers-4.44.2 added by https://github.com/pytorch/benchmark/pull/2488
34+
# is regressing speedup metric. This needs to be investigated further
35+
pip install transformers==4.38.1
36+
37+
echo "Print all dependencies after TorchBench is installed"
38+
python -mpip freeze
39+
popd
40+
}
41+
2242
# Pango is needed for weasyprint which is needed for doctr
2343
conda_install pango
2444
install_huggingface
2545
install_timm
46+
install_torchbench

.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
@@ -251,30 +251,6 @@ function clone_pytorch_xla() {
251251
fi
252252
}
253253

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

.ci/pytorch/test.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,12 +1662,10 @@ elif [[ "${TEST_CONFIG}" == *timm* ]]; then
16621662
elif [[ "${TEST_CONFIG}" == cachebench ]]; then
16631663
install_torchaudio
16641664
install_torchvision
1665-
checkout_install_torchbench nanogpt BERT_pytorch resnet50 hf_T5 llama moco
16661665
PYTHONPATH=$(pwd)/torchbench test_cachebench
16671666
elif [[ "${TEST_CONFIG}" == verify_cachebench ]]; then
16681667
install_torchaudio
16691668
install_torchvision
1670-
checkout_install_torchbench nanogpt
16711669
PYTHONPATH=$(pwd)/torchbench test_verify_cachebench
16721670
elif [[ "${TEST_CONFIG}" == *torchbench* ]]; then
16731671
install_torchaudio
@@ -1677,18 +1675,12 @@ elif [[ "${TEST_CONFIG}" == *torchbench* ]]; then
16771675
# https://github.com/opencv/opencv-python/issues/885
16781676
pip_install opencv-python==4.8.0.74
16791677
if [[ "${TEST_CONFIG}" == *inductor_torchbench_smoketest_perf* ]]; then
1680-
checkout_install_torchbench hf_Bert hf_Albert timm_vision_transformer
16811678
PYTHONPATH=$(pwd)/torchbench test_inductor_torchbench_smoketest_perf
16821679
elif [[ "${TEST_CONFIG}" == *inductor_torchbench_cpu_smoketest_perf* ]]; then
1683-
checkout_install_torchbench timm_vision_transformer phlippe_densenet basic_gnn_edgecnn \
1684-
llama_v2_7b_16h resnet50 timm_efficientnet mobilenet_v3_large timm_resnest \
1685-
functorch_maml_omniglot yolov3 mobilenet_v2 resnext50_32x4d densenet121 mnasnet1_0
16861680
PYTHONPATH=$(pwd)/torchbench test_inductor_torchbench_cpu_smoketest_perf
16871681
elif [[ "${TEST_CONFIG}" == *torchbench_gcp_smoketest* ]]; then
1688-
checkout_install_torchbench
16891682
TORCHBENCHPATH=$(pwd)/torchbench test_torchbench_gcp_smoketest
16901683
else
1691-
checkout_install_torchbench
16921684
# Do this after checkout_install_torchbench to ensure we clobber any
16931685
# nightlies that torchbench may pull in
16941686
if [[ "${TEST_CONFIG}" != *cpu* ]]; then

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