microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.61k stars 2.92k forks source link

cuda's FusedConv is not support Sigmod #20708

Open marktohark opened 5 months ago

marktohark commented 5 months ago

Describe the issue

2024-05-17 09:41:31.333218349 [E:onnxruntime:, inference_session.cc:1981 operator()] Exception during initialization: /onnxruntime_src/onnxruntime/contrib_ops/cuda/fused_conv.cc:19 onnxruntime::contrib::cuda::FusedConv::FusedConv(const onnxruntime::OpKernelInfo&) [with T = float] [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : unsupported conv activation mode "Sigmoid"

I use CUDA Provider to load onnx model, and show error.

python: 3.8.10 onnxruntime-gpu: 1.17.1 os: ubuntu 20.04 cuda: 11.8 cuDNN: 8.5.0

In onnxruntime/contrib_ops/cuda/fused_conv.cc

image

If I edit it to below and build wheel, will it work?
cudnnactivationmode-t struct

  Status MapMode(const std::string& activaton_mode) {
    if (activaton_mode == "Relu") {
      activation_mode_ = cudnnActivationMode_t::CUDNN_ACTIVATION_RELU;
    } else if (activaton_mode == "Sigmoid")
      activation_mode_ = cudnnActivationMode_t::CUDNN_ACTIVATION_SIGMOID;
    else {
      return ORT_MAKE_STATUS(
          StatusCategory::ONNXRUNTIME, StatusCode::INVALID_ARGUMENT,
          "unsupported conv activation mode \"", activaton_mode, "\"");
    }
    return Status::OK();
  }
  cudnnActivationMode_t activation_mode_;
  cudnnActivationDescriptor_t activation_desc_ = nullptr;
};

btw, cpu is supported. image

To reproduce

In onnx model, use FusedConv, and activation is "Sigmod".

Urgency

No response

Platform

Linux

OS Version

Ubuntu 20.04

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

onnxruntime-gpu 1.17.1

ONNX Runtime API

Python

Architecture

X64

Execution Provider

CUDA

Execution Provider Library Version

CUDA 11.8 and cuDNN 8.5.0

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

KeterSCP commented 2 months ago

Bumping this question. I have similar error on CUDA provider, but with INVALID_ARGUMENT : unsupported conv activation mode "Clip"