Skip to content

Commit f17e4ca

Browse files
committed
fix: Torch version switch to 2.1.0
- Fix constant folding import
1 parent 53b90f2 commit f17e4ca

File tree

6 files changed

+11
-22
lines changed

6 files changed

+11
-22
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ commands:
269269
default: "0.16.0.dev20230703+cu121"
270270
torch-build-index:
271271
type: string
272-
default: "https://download.pytorch.org/whl/nightly/cu121"
272+
default: "https://download.pytorch.org/whl/cu121"
273273
torchvision-build-index:
274274
type: string
275-
default: "https://download.pytorch.org/whl/nightly/cu121"
275+
default: "https://download.pytorch.org/whl/cu121"
276276
steps:
277277
- run:
278278
name: Install Torch
@@ -1457,7 +1457,7 @@ parameters:
14571457
default: "0.16.0.dev20230703+cu121"
14581458
torch-build-index:
14591459
type: string
1460-
default: "https://download.pytorch.org/whl/nightly/cu121"
1460+
default: "https://download.pytorch.org/whl/cu121"
14611461
cudnn-version:
14621462
type: string
14631463
default: "8.9.5.30"

.github/workflows/docgen.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ jobs:
3030
- name: Install base deps
3131
run: |
3232
python3 -m pip install pip --upgrade
33-
python3 -m pip install pyyaml numpy torch --pre --extra-index-url https://download.pytorch.org/whl/nightly/cu121
33+
python3 -m pip install pyyaml numpy torch --pre --extra-index-url https://download.pytorch.org/whl/cu121
3434
./packaging/pre_build_script.sh
3535
- name: Get HEAD SHA
3636
id: vars
3737
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
3838
- name: Build Python Package
3939
run: |
40-
python3 -m pip install --pre . --extra-index-url https://download.pytorch.org/whl/nightly/cu121
40+
python3 -m pip install --pre . --extra-index-url https://download.pytorch.org/whl/cu121
4141
- name: Generate New Docs
4242
run: |
4343
cd docsrc

WORKSPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ http_archive(
5454
name = "libtorch",
5555
build_file = "@//third_party/libtorch:BUILD",
5656
strip_prefix = "libtorch",
57-
urls = ["https://download.pytorch.org/libtorch/test/cu121/libtorch-cxx11-abi-shared-with-deps-latest.zip"],
57+
urls = ["https://download.pytorch.org/libtorch/cu121/libtorch-cxx11-abi-shared-with-deps-2.1.0%2Bcu121.zip"],
5858
)
5959

6060
http_archive(
6161
name = "libtorch_pre_cxx11_abi",
6262
build_file = "@//third_party/libtorch:BUILD",
6363
strip_prefix = "libtorch",
64-
urls = ["https://download.pytorch.org/libtorch/test/cu121/libtorch-shared-with-deps-latest.zip"],
64+
urls = ["https://download.pytorch.org/libtorch/cu121/libtorch-shared-with-deps-2.1.0%2Bcu121.zip"],
6565
)
6666

6767
# Download these tarballs manually from the NVIDIA website

docker/dist-build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
TOP_DIR=$(cd $(dirname $0); pwd)/..
44

55
if [[ -z "${USE_CXX11}" ]]; then
6-
BUILD_CMD="python -m pip wheel . --extra-index-url https://download.pytorch.org/whl/nightly/cu121 -w dist"
6+
BUILD_CMD="python -m pip wheel . --extra-index-url https://download.pytorch.org/whl/cu121 -w dist"
77
else
8-
BUILD_CMD="python -m pip wheel . --config-setting="--build-option=--use-cxx11-abi" --extra-index-url https://download.pytorch.org/whl/nightly/cu121 -w dist"
8+
BUILD_CMD="python -m pip wheel . --config-setting="--build-option=--use-cxx11-abi" --extra-index-url https://download.pytorch.org/whl/cu121 -w dist"
99
fi
1010

1111
# TensorRT restricts our pip version

py/torch_tensorrt/dynamo/lowering/passes/constant_folding.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,11 @@
22
from typing import Any, Sequence
33

44
import torch
5-
from torch_tensorrt._utils import sanitized_torch_version
5+
from torch._inductor.freezing import ConstantFolder, replace_node_with_constant
66
from torch_tensorrt.dynamo.lowering.passes.pass_utils import (
77
clean_up_graph_after_modifications,
88
)
99

10-
from packaging import version
11-
12-
# Modify import location of utilities based on Torch version
13-
if version.parse(sanitized_torch_version()) < version.parse("2.1.1"):
14-
from torch._inductor.freezing import ConstantFolder, replace_node_with_constant
15-
else:
16-
from torch._inductor.constant_folding import (
17-
ConstantFolder,
18-
replace_node_with_constant,
19-
)
20-
2110
logger = logging.getLogger(__name__)
2211

2312

tools/perf/benchmark.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ for bs in ${batch_sizes[@]}
105105
do
106106
python perf_run.py --model ${MODELS_DIR}/bert_base_uncased_traced.jit.pt \
107107
--model_torch "bert_base_uncased" \
108-
--precision fp32 --inputs="(${bs}, 128)@int32;(${bs}, 128)@int32" \
108+
--precision fp32,fp16 --inputs="(${bs}, 128)@int32;(${bs}, 128)@int32" \
109109
--batch_size ${bs} \
110110
--backends torch,ts_trt,dynamo,torch_compile,inductor \
111111
--truncate \

0 commit comments

Comments
 (0)