cassiebreviu / StableDiffusion

Inference Stable Diffusion with C# and ONNX Runtime
MIT License
218 stars 49 forks source link

Cuda error for kernel image #25

Closed bamdad-b closed 10 months ago

bamdad-b commented 11 months ago

Hi, thanks for the great project. I can run the project in CPU mode, but when I switch to cuda, the following error is thrown on running text encoding session:

Microsoft.ML.OnnxRuntime.OnnxRuntimeException: '[ErrorCode:Fail] Non-zero status code returned while running Slice node. Name:'Slice_218' Status Message: CUDA error cudaErrorNoKernelImageForDevice:no kernel image is available for execution on the device'

I'm using Windows 10, nvidia GT 710

LeonNerd commented 10 months ago

hi ,i have an error when run the project in CPU mode. My tool is vs2022,net6.0, I can rebuild the project from sln When I configured the model path and chose to run cpu only,an error will occur. ''' Microsoft.ML.OnnxRuntime.OnnxRuntimeException:“[ErrorCode:InvalidArgument] Tensor element data type discovered: Int64 metadata expected: Float” '''

''' I checked the code location is UNet.cs line105 input = CreateUnetModelInput(textEmbeddings, latentModelInput, timesteps[t]); // Run Inference var output = unetSession.Run(input); ''' input is a list with three objects.I don't know why this mistake happened,I guess it's because of the onnxruntime version. But the onnxruntime is built automatically by sln

cassiebreviu commented 10 months ago

@bamdad-b What version of cuda and onnxruntime are you using? Make sure you have compatible version installed. You can find this list here: https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html

cassiebreviu commented 10 months ago

@LeonNerd You have an input type issue. I answered that question on your original thread. Please take a look there. Thanks!