pytorch/ios-demo-app

Release Mode

hariravi opened this issue · 10 comments

Hi All,

I am unable to get the code to compile in release mode (as opposed to debug), I get EXC_BAD_ACCESS (in run scheme I changed everything from debug to release). How can I overcome this (I have my own personal app using libtorch and I cannot push it to testflight).

Thank you very much for the help, and great demo.

Is there a way to perhaps compile models in Debug and Release modes? It seems like the underlying structure of the .pt models are just dictionaries (so I think they trace_script.py should be correct for both), I also noticed LibTorch.debug.xcconfig and LibTorch.release.xcconfig seem identical.

Thank you again, been struggling debugging this, was very surprised to see when I released my product to testflight it would crash when the model attempted to predict!

I am having the same issue. It crashes in release mode. Any solution?

In my build settings I set my release flags to mirror debug, and that fixed it!

@hariravi thanks. Can you describe it in detail?

I can see Header Search Path as: "$(PODS_ROOT)/LibTorch/install/include/"

and PODS_ROOT is set to path-to-project-on-machine/Pods

is it this thing causing the trouble?

I am actually not sure it might have been the Optimization Level (change it to None on release)? I just tried changing things one by one and eventually it worked, I know the issue is the scheme, and try changing Release flags to mirror the Debug (start with optimization level)!

Thanks @hariravi. I changed Optimization level flag to None for the release mode and it runs okay now.

Hi!
Is there another solution to this problem? Is this the expected behaviour?
For me it's not a solution to turn of the optimization for a release app.

Disable NNPACK

But is there a better solution?
Changing the optimization level to none is not an option for us.