Steffenhir / GraXpert

GraXpert is an astronomical image processing program for extracting and removing gradients from the background of your astrophotos.
https://www.graxpert.com/
GNU General Public License v3.0
162 stars 19 forks source link

Mac AI models 3.x fail - Error compiling model #178

Open notnicehat opened 3 months ago

notnicehat commented 3 months ago

Mac user here with version 3.0.2 - attempting to use any of the 3.x Denoise AI models (3.0.0, 3.0.1, 3.0.2) result in an error. I can use the 2.x AI models for denoise, but I'm not sure why it's not working. I cleared the 3.x models out and ran a denoise which downloaded the 3.0.2 model then attempted to denoise and fails.

Screenshot of the ~/Library/ApplicationSupport/GraXpert/denoise-ai-models folder - model.onnx is present Screenshot 2024-07-03 at 12 29 27 PM

Log included - I selected 3.0.2 and it downloads the new model and fails upon denoising: graxpert.log

2024-07-03 12:26:27,315 MainProcess root INFO Progress: 100% 2024-07-03 12:26:28,873 MainProcess root INFO Starting denoising 2024-07-03 12:26:30,099 MainProcess root ERROR [ONNXRuntimeError] : 1 : FAIL : Error compiling model: compiler error: Espresso exception: "Invalid blob shape": generic_elementwise_kernel: cannot broadcast: (1, 300, 1, 1) (1, 123, 1, 1) Traceback (most recent call last): File "graxpert/application/app.py", line 350, in on_denoise_request File "graxpert/denoising.py", line 70, in denoise File "onnxruntime/capi/onnxruntime_inference_collection.py", line 419, in init File "onnxruntime/capi/onnxruntime_inference_collection.py", line 483, in _create_inference_session onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Error compiling model: compiler error: Espresso exception: "Invalid blob shape": generic_elementwise_kernel: cannot broadcast: (1, 300, 1, 1) (1, 123, 1, 1)

linudaar commented 2 months ago

Same here. Mac, Sonoma, AMD64. v3.x models return the same error. v2.x models work.

mikegeyser commented 2 weeks ago

Hi, just chiming in. I get the same issue but I think it might be with the GPU acceleration of the AI models, rather than the models themselves? So if you disable the AI Hardware Acceleration toggle you can get the 3.0.2 models working without the error (at least that worked for me, YMMV).

image

(In case it's relevant, AMD64 + Mac Sonoma 14.6.1)

notnicehat commented 2 weeks ago

Hi, just chiming in. I get the same issue but I think it might be with the GPU acceleration of the AI models, rather than the models themselves? So if you disable the AI Hardware Acceleration toggle you can get the 3.0.2 models working without the error (at least that worked for me, YMMV).

image

(In case it's relevant, AMD64 + Mac Sonoma 14.6.1)

Unchecking the "Enable Acceleration" toggle worked! thank you. the 3.0.2 model does work better but without the hardware acceleration it is at least twice as slow. Guess I need to buy some apple silicon.

Not sure if this should be marked as resolved - at the very least it requires a note or an update to the error message.

mikegeyser commented 2 weeks ago

Thanks for checking and confirming. 😁

After getting it working, I don't see very much improvement in the 3.0 models over the 2.0 models. I'm not sure why, but the result that I get when running denoise aggressively is a far cry from what others are experiencing. At full strength I get maybe a small incremental improvement in noise.

The commonality above is windows... So I'd love to know if anyone is getting these kinds of dramatic results using mac, and if so what I'm doing wrong, or if my expectations are simply unrealistic.

(Just to be crystal clear, I totally understand that this is a personal/hobby project for the maintainers and don't feel any entitlement. Fixing this for Mac is likely not a priority, I just don't have a windows machine and would love to join the fun with this excellent tool.)

Original Original

Denoised at full strength Denoised at full strength