Skip to content

Commit

Permalink
feat: Update Pytorch version to 1.11
Browse files Browse the repository at this point in the history
Signed-off-by: Dheeraj Peri <[email protected]>
  • Loading branch information
peri044 committed Apr 6, 2022
1 parent f1f151b commit c009a1f
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ torch.jit.save(trt_ts_module, "trt_torchscript_module.ts") # save the TRT embedd
These are the following dependencies used to verify the testcases. Torch-TensorRT can work with other versions, but the tests are not guaranteed to pass.

- Bazel 4.2.1
- Libtorch 1.10.0 (built with CUDA 11.3)
- Libtorch 1.11.0 (built with CUDA 11.3)
- CUDA 11.3 (10.2 on Jetson)
- cuDNN 8.2.1
- TensorRT 8.2.4.2 (TensorRT 8.2.1 on Jetson)
Expand Down
8 changes: 4 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ new_local_repository(
http_archive(
name = "libtorch",
build_file = "@//third_party/libtorch:BUILD",
sha256 = "190e963e739d5f7c2dcf94b3994de8fcd335706a4ebb333812ea7d8c841beb06",
sha256 = "8d9e829ce9478db4f35bdb7943308cf02e8a2f58cf9bb10f742462c1d57bf287",
strip_prefix = "libtorch",
urls = ["https://download.pytorch.org/libtorch/cu113/libtorch-cxx11-abi-shared-with-deps-1.10.0%2Bcu113.zip"],
urls = ["https://download.pytorch.org/libtorch/cu113/libtorch-cxx11-abi-shared-with-deps-1.11.0%2Bcu113.zip"],
)

http_archive(
name = "libtorch_pre_cxx11_abi",
build_file = "@//third_party/libtorch:BUILD",
sha256 = "0996a6a4ea8bbc1137b4fb0476eeca25b5efd8ed38955218dec1b73929090053",
sha256 = "90159ecce3ff451f3ef3f657493b6c7c96759c3b74bbd70c1695f2ea2f81e1ad",
strip_prefix = "libtorch",
urls = ["https://download.pytorch.org/libtorch/cu113/libtorch-shared-with-deps-1.10.0%2Bcu113.zip"],
urls = ["https://download.pytorch.org/libtorch/cu113/libtorch-shared-with-deps-1.11.0%2Bcu113.zip"],
)

# Download these tarballs manually from the NVIDIA website
Expand Down
3 changes: 2 additions & 1 deletion core/conversion/evaluators/eval_util.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <ATen/ATen.h>
#include "ATen/InitialTensorOptions.h"
#include "ATen/core/List.h"
#include "ATen/core/functional.h"
Expand Down Expand Up @@ -238,7 +239,7 @@ at::Tensor createTensorFromList(
/// Gets shape of tensor to be created
auto sizes = compute_sizes(data);
checkListInputType(elem_type, sizes.size() == 1 && sizes[0] == 0);
at::ScalarType initial_scalar_type = c10::scalarTypeFromJitType(elem_type);
at::ScalarType initial_scalar_type = c10::scalarTypeFromJitType(*elem_type);
if (initial_scalar_type == at::ScalarType::Double) {
initial_scalar_type = at::typeMetaToScalarType(c10::get_default_dtype());
}
Expand Down
6 changes: 3 additions & 3 deletions core/lowering/passes/linear_to_addmm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include "torch/csrc/jit/passes/guard_elimination.h"
#include "torch/csrc/jit/passes/peephole.h"
#include "torch/csrc/jit/runtime/graph_executor.h"

#include "core/util/prelude.h"
#include "torch/csrc/jit/api/function_impl.h"
#include "torch/csrc/jit/passes/subgraph_rewrite.h"
#include "core/util/prelude.h"

namespace torch_tensorrt {
namespace core {
Expand All @@ -34,7 +34,7 @@ void replaceLinearWithBiasNonePattern(std::shared_ptr<torch::jit::Graph> graph)
continue;
} else {
torch::jit::WithInsertPoint guard(*it);
std::shared_ptr<torch::jit::Graph> d_graph = decompose_funcs.get_function("linear").graph();
std::shared_ptr<torch::jit::Graph> d_graph = toGraphFunction(decompose_funcs.get_function("linear")).graph();;
torch::jit::Value* new_output = insertGraph(*it->owningGraph(), *d_graph, it->inputs()).at(0);
new_output->setType(it->output()->type());
it->output()->replaceAllUsesWith(new_output);
Expand Down
1 change: 1 addition & 0 deletions core/partitioning/shape_analysis.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <ATen/ATen.h>
#include "core/partitioning/shape_analysis.h"
#include "core/util/prelude.h"
#include "torch/csrc/jit/api/module.h"
Expand Down
2 changes: 1 addition & 1 deletion py/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-f https://download.pytorch.org/whl/torch_stable.html
torch==1.10.0+cu113
torch==1.11.0+cu113
pybind11==2.6.2
2 changes: 1 addition & 1 deletion tests/cpp/test_modules_as_engines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ INSTANTIATE_TEST_SUITE_P(
PathAndInSize({"tests/modules/resnet18_scripted.jit.pt", {{1, 3, 224, 224}}, 2e-5}),
PathAndInSize({"tests/modules/resnet50_scripted.jit.pt", {{1, 3, 224, 224}}, 2e-5}),
PathAndInSize({"tests/modules/mobilenet_v2_scripted.jit.pt", {{1, 3, 224, 224}}, 2e-5}),
PathAndInSize({"tests/modules/efficientnet_b0_scripted.jit.pt", {{1, 3, 224, 224}}, 2e-5}),
PathAndInSize({"tests/modules/efficientnet_b0_scripted.jit.pt", {{1, 3, 224, 224}}, 1e-4}),
PathAndInSize({"tests/modules/vit_scripted.jit.pt", {{1, 3, 224, 224}}, 8e-2})));

#endif
2 changes: 1 addition & 1 deletion tests/modules/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-f https://download.pytorch.org/whl/torch_stable.html
timm==v0.4.12
torch==1.10.0+cu113
torch==1.11.0+cu113
2 changes: 1 addition & 1 deletion tests/py/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
torchvision==0.11.1+cu113
torchvision==0.12.0+cu113
-f https://download.pytorch.org/whl/torch_stable.html
2 changes: 1 addition & 1 deletion tests/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <string>
#include <vector>

#include <ATen/ATen.h>
#include "ATen/Tensor.h"
#include "core/ir/ir.h"
#include "core/util/prelude.h"
Expand Down
5 changes: 0 additions & 5 deletions third_party/libtorch/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,9 @@ cc_library(
srcs = select({
":windows": [
"lib/caffe2_nvrtc.lib",
"lib/caffe2_detectron_ops_gpu.lib",
"lib/caffe2_module_test_dynamic.lib",
],
"//conditions:default": [
"lib/libcaffe2_nvrtc.so",
"lib/libcaffe2_detectron_ops_gpu.so",
"lib/libcaffe2_observers.so",
"lib/libcaffe2_module_test_dynamic.so",
],
}),
hdrs = glob([
Expand Down

0 comments on commit c009a1f

Please sign in to comment.