Browse Source

update pnnx ci with torch 2.7 (#6018)

tags/20250428
nihui GitHub 1 year ago
parent
commit
76ce92073e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
12 changed files with 52 additions and 14 deletions
  1. +8
    -4
      .ci/pnnx.yml
  2. +34
    -0
      tools/pnnx/src/pass_level2/torch_stft.cpp
  3. +1
    -1
      tools/pnnx/tests/onnx/test_F_relu.py
  4. +1
    -1
      tools/pnnx/tests/onnx/test_convnext_tiny.py
  5. +1
    -1
      tools/pnnx/tests/onnx/test_mobilenet_v2.py
  6. +1
    -1
      tools/pnnx/tests/onnx/test_mobilenet_v3_small.py
  7. +1
    -1
      tools/pnnx/tests/onnx/test_nn_ReLU.py
  8. +1
    -1
      tools/pnnx/tests/onnx/test_resnet18.py
  9. +1
    -1
      tools/pnnx/tests/onnx/test_shufflenet_v2_x1_0.py
  10. +1
    -1
      tools/pnnx/tests/onnx/test_squeezenet1_1.py
  11. +1
    -1
      tools/pnnx/tests/onnx/test_swin_t.py
  12. +1
    -1
      tools/pnnx/tests/onnx/test_vit_b_32.py

+ 8
- 4
.ci/pnnx.yml View File

@@ -19,10 +19,10 @@ concurrency:

variables:
protobuf_version: 21.12
libtorch_version: 2.6.0
libtorchvision_version: 0.21.0
onnxruntime_version: 1.21.0
cache_date: 20250402
libtorch_version: 2.7.0
libtorchvision_version: 0.22.0
onnxruntime_version: 1.21.1
cache_date: 20250423

jobs:
ubuntu:
@@ -81,6 +81,10 @@ jobs:
torchvision-version: 0.21.0
torchaudio-version: '2.6.0+cpu'

- torch-version: 2.7.0
torchvision-version: 0.22.0
torchaudio-version: '2.7.0+cpu'

runs-on:
pool-name: docker
container:


+ 34
- 0
tools/pnnx/src/pass_level2/torch_stft.cpp View File

@@ -50,7 +50,41 @@ pnnx.Output output 1 0 out
}
};

class torch_stft_0 : public torch_stft
{
public:
const char* match_pattern_graph() const
{
return R"PNNXIR(7767517
11 10
pnnx.Input input_0 0 1 input
pnnx.Input input_1 0 1 window
prim::Constant op_0 0 1 n_fft value=%n_fft
prim::Constant op_1 0 1 hop_length value=%hop_length
prim::Constant op_2 0 1 win_length value=%win_length
prim::Constant op_3 0 1 normalized value=%normalized
prim::Constant op_4 0 1 onesided value=%onesided
prim::Constant op_5 0 1 return_complex value=%return_complex
prim::Constant op_6 0 1 align_to_window value=%align_to_window
aten::stft op_7 9 1 input n_fft hop_length win_length window normalized onesided return_complex align_to_window out
pnnx.Output output 1 0 out
)PNNXIR";
}

void write(Operator* op, const std::map<std::string, Parameter>& captured_params) const
{
torch_stft::write(op, captured_params);

// keep align_to_window param only when enabled
if (captured_params.at("align_to_window").type != 1 || captured_params.at("align_to_window").b == false)
{
op->params.erase("align_to_window");
}
}
};

REGISTER_GLOBAL_PNNX_GRAPH_REWRITER_PASS(torch_stft, 80)
REGISTER_GLOBAL_PNNX_GRAPH_REWRITER_PASS(torch_stft_0, 80)

class torch_stft_1 : public GraphRewriterPass
{


+ 1
- 1
tools/pnnx/tests/onnx/test_F_relu.py View File

@@ -59,7 +59,7 @@ def test():
if not torch.allclose(a0, b0, 1e-4, 1e-4):
return False

if version.parse(torch.__version__) < version.parse('2.7'):
if version.parse(torch.__version__) < version.parse('2.8'):
return True

# export dynamo onnx


+ 1
- 1
tools/pnnx/tests/onnx/test_convnext_tiny.py View File

@@ -43,7 +43,7 @@ def test():
if not torch.allclose(a, b, 1e-4, 1e-4):
return False

if version.parse(torch.__version__) < version.parse('2.7'):
if version.parse(torch.__version__) < version.parse('2.8'):
return True

# export dynamo onnx


+ 1
- 1
tools/pnnx/tests/onnx/test_mobilenet_v2.py View File

@@ -39,7 +39,7 @@ def test():
if not torch.allclose(a, b, 1e-4, 1e-4):
return False

if version.parse(torch.__version__) < version.parse('2.7'):
if version.parse(torch.__version__) < version.parse('2.8'):
return True

# export dynamo onnx


+ 1
- 1
tools/pnnx/tests/onnx/test_mobilenet_v3_small.py View File

@@ -42,7 +42,7 @@ def test():
if not torch.allclose(a, b, 1e-4, 1e-4):
return False

if version.parse(torch.__version__) < version.parse('2.7'):
if version.parse(torch.__version__) < version.parse('2.8'):
return True

# export dynamo onnx


+ 1
- 1
tools/pnnx/tests/onnx/test_nn_ReLU.py View File

@@ -61,7 +61,7 @@ def test():
if not torch.allclose(a0, b0, 1e-4, 1e-4):
return False

if version.parse(torch.__version__) < version.parse('2.7'):
if version.parse(torch.__version__) < version.parse('2.8'):
return True

# export dynamo onnx


+ 1
- 1
tools/pnnx/tests/onnx/test_resnet18.py View File

@@ -39,7 +39,7 @@ def test():
if not torch.allclose(a, b, 1e-4, 1e-4):
return False

if version.parse(torch.__version__) < version.parse('2.7'):
if version.parse(torch.__version__) < version.parse('2.8'):
return True

# export dynamo onnx


+ 1
- 1
tools/pnnx/tests/onnx/test_shufflenet_v2_x1_0.py View File

@@ -39,7 +39,7 @@ def test():
if not torch.allclose(a, b, 1e-4, 1e-4):
return False

if version.parse(torch.__version__) < version.parse('2.7'):
if version.parse(torch.__version__) < version.parse('2.8'):
return True

# export dynamo onnx


+ 1
- 1
tools/pnnx/tests/onnx/test_squeezenet1_1.py View File

@@ -39,7 +39,7 @@ def test():
if not torch.allclose(a, b, 1e-4, 1e-4):
return False

if version.parse(torch.__version__) < version.parse('2.7'):
if version.parse(torch.__version__) < version.parse('2.8'):
return True

# export dynamo onnx


+ 1
- 1
tools/pnnx/tests/onnx/test_swin_t.py View File

@@ -43,7 +43,7 @@ def test():
if not torch.allclose(a, b, 1e-4, 1e-4):
return False

if version.parse(torch.__version__) < version.parse('2.7'):
if version.parse(torch.__version__) < version.parse('2.8'):
return True

# export dynamo onnx


+ 1
- 1
tools/pnnx/tests/onnx/test_vit_b_32.py View File

@@ -46,7 +46,7 @@ def test():
if not torch.allclose(a, b, 1e-4, 1e-4):
return False

if version.parse(torch.__version__) < version.parse('2.7'):
if version.parse(torch.__version__) < version.parse('2.8'):
return True

# export dynamo onnx


Loading…
Cancel
Save