Skip to content

Commit 6d42264

Browse files
authored
bump PyTorch version to 1.11 (#10794)
* bump PyTorch version to 1.11 * disable some caffe2 ci * Fix sub conversion in PyTorch frontend * use fuse_modules_qat if available, fallback to fuse_modules for older PyTorch * Re-Run CI
1 parent b2a0e1d commit 6d42264

File tree

6 files changed

+17
-156
lines changed

6 files changed

+17
-156
lines changed

docker/Dockerfile.ci_gpu

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ RUN bash /install/ubuntu_install_onnx.sh
7777
COPY install/ubuntu_install_tflite.sh /install/ubuntu_install_tflite.sh
7878
RUN bash /install/ubuntu_install_tflite.sh
7979

80-
COPY install/ubuntu_install_caffe2.sh /install/ubuntu_install_caffe2.sh
81-
RUN bash /install/ubuntu_install_caffe2.sh
82-
8380
COPY install/ubuntu_install_dgl.sh /install/ubuntu_install_dgl.sh
8481
RUN bash /install/ubuntu_install_dgl.sh
8582

docker/install/ubuntu_install_onnx.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ pip3 install \
3636
pip3 install future
3737

3838
pip3 install \
39-
torch==1.10.1 \
40-
torchvision==0.11.2
39+
torch==1.11.0 \
40+
torchvision==0.12.0

gallery/how_to/compile_models/from_caffe2.py

Lines changed: 0 additions & 145 deletions
This file was deleted.

python/tvm/relay/frontend/pytorch.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,6 +2039,14 @@ def stack(self, inputs, input_types):
20392039
assert isinstance(ty, tvm.ir.TypeCall) and ty.func == list_ty, msg
20402040
return self.tensor_array_stack(inputs, input_types)
20412041

2042+
def sub(self, inputs, input_types):
2043+
if len(inputs) == 3:
2044+
data0, data1, alpha = self.pytorch_promote_types(inputs, input_types)
2045+
return get_relay_op("subtract")(data0, alpha * data1)
2046+
else:
2047+
data0, data1= self.pytorch_promote_types(inputs, input_types)
2048+
return get_relay_op("subtract")(data0, data1)
2049+
20422050
def rsub(self, inputs, input_types):
20432051
data0, data1, alpha = self.pytorch_promote_types(inputs, input_types)
20442052

@@ -2859,7 +2867,10 @@ def all_any_common(self, op, inputs, input_types):
28592867
inp = inputs[0]
28602868
return op(inp, axis=dim, keepdims=keepdim)
28612869

2862-
def searchsorted_common(self, sorted_sequence, values, out_int32, right):
2870+
def searchsorted_common(
2871+
self, sorted_sequence, values, out_int32, right, side=None, out=None, sorter=None
2872+
):
2873+
assert side is None and out is None and sorter is None, "unsupported parameters"
28632874
dtype = "int32" if out_int32 else "int64"
28642875
values_shape = _infer_shape(values)
28652876

@@ -2959,7 +2970,7 @@ def create_convert_map(self):
29592970
"aten::pixel_shuffle": self.pixel_shuffle,
29602971
"aten::device": self.none,
29612972
"prim::device": self.none,
2962-
"aten::sub": self.make_elemwise("subtract"),
2973+
"aten::sub": self.sub,
29632974
"aten::max": self.max,
29642975
"aten::min": self.min,
29652976
"aten::mul": self.make_elemwise("multiply"),

tests/python/frontend/pytorch/qnn_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,9 +743,10 @@ def __init__(self, inputsize=(128, 128)):
743743
self.backbone = Backbone()
744744

745745
def fuse_model(self):
746+
fuse_modules_qat = getattr(torch.ao.quantization, "fuse_modules_qat", fuse_modules)
746747
for idx, m in enumerate(self.modules()):
747748
if type(m) == ConvBnRelu:
748-
torch.quantization.fuse_modules(m, ["conv", "bn", "relu"], inplace=True)
749+
fuse_modules_qat(m, ["conv", "bn", "relu"], inplace=True)
749750

750751
def forward(self, input):
751752
input = self.quant(input)

tests/scripts/task_python_frontend.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ function shard2 {
5656
i=$((i+1))
5757
done
5858

59-
echo "Running relay caffe2 frontend test..."
60-
run_pytest cython python-frontend-caffe2 tests/python/frontend/caffe2
61-
6259
echo "Running relay DarkNet frontend test..."
6360
run_pytest cython python-frontend-darknet tests/python/frontend/darknet
6461

0 commit comments

Comments
 (0)