Skip to content

Commit 3a3eded

Browse files
authored
Merge pull request #438 from NVIDIA/1.8.1_update
feat(WORKSPACE)!: Updating PyTorch version to 1.8.1
2 parents 3ec5586 + d97ae1f commit 3a3eded

File tree

8 files changed

+32
-20
lines changed

8 files changed

+32
-20
lines changed

.github/scripts/run_cpp_linter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
if output.returncode != 0:
2424
comment = '''There are some changes that do not conform to C++ style guidelines:\n ```diff\n{}```'''.format(output.stdout.decode("utf-8"))
2525
approval = 'REQUEST_CHANGES'
26-
exit(1)
2726

2827
pr.create_review(commit, comment, approval)
2928

30-
29+
if output.returncode != 0:
30+
exit(1)
31+
else:
32+
exit(0)

.github/scripts/run_py_linter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
if output.returncode != 0:
2424
comment = '''There are some changes that do not conform to Python style guidelines:\n ```diff\n{}```'''.format(output.stdout.decode("utf-8"))
2525
approval = 'REQUEST_CHANGES'
26-
exit(1)
2726

2827
pr.create_review(commit, comment, approval)
28+
29+
if output.returncode != 0:
30+
exit(1)
31+
else:
32+
exit(0)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ torch.jit.save(trt_ts_module, "trt_torchscript_module.ts")
7474
These are the following dependencies used to verify the testcases. TRTorch can work with other versions, but the tests are not guaranteed to pass.
7575

7676
- Bazel 4.0.0
77-
- Libtorch 1.8.0 (built with CUDA 11.1)
77+
- Libtorch 1.8.1 (built with CUDA 11.1)
7878
- CUDA 11.1 (10.2 on Jetson)
7979
- cuDNN 8.1
8080
- TensorRT 7.2.3

WORKSPACE

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ http_archive(
4545
name = "libtorch",
4646
build_file = "@//third_party/libtorch:BUILD",
4747
strip_prefix = "libtorch",
48-
sha256 = "62a2c06761c32576b30f5884240cf675b937945d929e4b13cc776de8d9c2236c",
49-
urls = ["https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.8.0%2Bcu111.zip"],
48+
sha256 = "1f8aec376f9343538bd7c2fd3abb81ed3af11f575efe3aa72777c4d62044b832",
49+
urls = ["https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.8.1%2Bcu111.zip"],
5050
)
5151

5252
http_archive(
5353
name = "libtorch_pre_cxx11_abi",
5454
build_file = "@//third_party/libtorch:BUILD",
5555
strip_prefix = "libtorch",
56-
sha256 = "1c8b0c0883dd17f5ce952d42ec5f7f0cc7ceb370307535cee26a66c10419f1f6",
57-
urls = ["https://download.pytorch.org/libtorch/cu111/libtorch-shared-with-deps-1.8.0%2Bcu111.zip"],
56+
sha256 = "3a6e0dc11859111e75caa640c8ce9bf904fbb6e9992b4345e444ed5410e4d77e",
57+
urls = ["https://download.pytorch.org/libtorch/cu111/libtorch-shared-with-deps-1.8.1%2Bcu111.zip"],
5858
)
5959

6060
# Download these tarballs manually from the NVIDIA website
@@ -63,15 +63,19 @@ http_archive(
6363

6464
http_archive(
6565
name = "cudnn",
66-
urls = ["https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.1.1.33/11.2_20210301/cudnn-11.2-linux-x64-v8.1.1.33.tgz",],
66+
urls = [
67+
"https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.1.1.33/11.2_20210301/cudnn-11.2-linux-x64-v8.1.1.33.tgz",
68+
],
6769
build_file = "@//third_party/cudnn/archive:BUILD",
6870
sha256 = "98a8784e92862f20018d20c281b30d4a0cd951f93694f6433ccf4ae9c502ba6a",
6971
strip_prefix = "cuda"
7072
)
7173

7274
http_archive(
7375
name = "tensorrt",
74-
urls = ["https://developer.nvidia.com/compute/machine-learning/tensorrt/secure/7.2.3/tars/TensorRT-7.2.3.4.Ubuntu-18.04.x86_64-gnu.cuda-11.1.cudnn8.1.tar.gz",],
76+
urls = [
77+
"https://developer.nvidia.com/compute/machine-learning/tensorrt/secure/7.2.3/tars/TensorRT-7.2.3.4.Ubuntu-18.04.x86_64-gnu.cuda-11.1.cudnn8.1.tar.gz",
78+
],
7579
build_file = "@//third_party/tensorrt/archive:BUILD",
7680
strip_prefix = "TensorRT-7.2.3.4",
7781
sha256 = "d3a1f478e304b48878604fac70ce7920fece71f9cac62f925c9c59c197f5d087"

core/conversion/var/Var.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ nvinfer1::ITensor* Var::ITensorOrFreeze(ConversionCtx* ctx) {
8989
if (isIValue()) {
9090
LOG_DEBUG(ctx->logger, "Found IValue containing object of type " << *(ptr_.ivalue->type()));
9191
}
92-
92+
9393
TRTORCH_CHECK(
9494
isITensor() || (isIValue() && (ptr_.ivalue->isTensor() || ptr_.ivalue->isCustomClass())),
9595
"Requested either IValue containing a Tensor, or ITensor, however Var type is " << type_name());
@@ -100,8 +100,10 @@ nvinfer1::ITensor* Var::ITensorOrFreeze(ConversionCtx* ctx) {
100100
if (ptr_.ivalue->isTensor()) {
101101
auto weights = converters::Weights();
102102
auto tensor = ptr_.ivalue->toTensor();
103-
if ((tensor.scalar_type() == at::kLong || tensor.scalar_type() == at::kDouble) && !ctx->settings.truncate_long_and_double) {
104-
TRTORCH_THROW_ERROR("Unable to freeze tensor of type Int64/Float64 into constant layer, try to compile model with truncate_long_and_double enabled");
103+
if ((tensor.scalar_type() == at::kLong || tensor.scalar_type() == at::kDouble) &&
104+
!ctx->settings.truncate_long_and_double) {
105+
TRTORCH_THROW_ERROR(
106+
"Unable to freeze tensor of type Int64/Float64 into constant layer, try to compile model with truncate_long_and_double enabled");
105107
} else if (tensor.scalar_type() == at::kLong && ctx->settings.truncate_long_and_double) {
106108
weights = converters::Weights(ctx, tensor.toType(at::kInt));
107109
LOG_WARNING("Truncating weight (constant in the graph) from Int64 to Int32");
@@ -111,7 +113,7 @@ nvinfer1::ITensor* Var::ITensorOrFreeze(ConversionCtx* ctx) {
111113
} else {
112114
weights = converters::Weights(ctx, tensor);
113115
}
114-
116+
115117
auto const_layer = ctx->net->addConstant(weights.shape, weights.data);
116118
TRTORCH_CHECK(const_layer, "Unable to freeze tensor into constant layer");
117119
out = const_layer->getOutput(0);

cpp/ptq/training/vgg16/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def test(model, dataloader, crit, epoch):
167167
model.eval()
168168
with torch.no_grad():
169169
for data, labels in dataloader:
170-
data, labels = data.cuda(), labels.cuda(async=True)
170+
data, labels = data.cuda(), labels.cuda(non_blocking=True)
171171
out = model(data)
172172
loss += crit(out, labels)
173173
preds = torch.max(out, 1)[1]

docker/WORKSPACE.docs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ http_archive(
5353
name = "libtorch",
5454
build_file = "@//third_party/libtorch:BUILD",
5555
strip_prefix = "libtorch",
56-
sha256 = "62a2c06761c32576b30f5884240cf675b937945d929e4b13cc776de8d9c2236c",
57-
urls = ["https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.8.0%2Bcu111.zip"],
56+
sha256 = "1f8aec376f9343538bd7c2fd3abb81ed3af11f575efe3aa72777c4d62044b832",
57+
urls = ["https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.8.1%2Bcu111.zip"],
5858
)
5959

6060
http_archive(
6161
name = "libtorch_pre_cxx11_abi",
6262
build_file = "@//third_party/libtorch:BUILD",
6363
strip_prefix = "libtorch",
64-
sha256 = "1c8b0c0883dd17f5ce952d42ec5f7f0cc7ceb370307535cee26a66c10419f1f6",
65-
urls = ["https://download.pytorch.org/libtorch/cu111/libtorch-shared-with-deps-1.8.0%2Bcu111.zip"],
64+
sha256 = "3a6e0dc11859111e75caa640c8ce9bf904fbb6e9992b4345e444ed5410e4d77e",
65+
urls = ["https://download.pytorch.org/libtorch/cu111/libtorch-shared-with-deps-1.8.1%2Bcu111.zip"],
6666
)
6767

6868
####################################################################################

py/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
torch==1.8.0
1+
torch==1.8.1
22
pybind11==2.6.2

0 commit comments

Comments
 (0)