I’m using U-2-Net on mobile.
I converted the model to TorchScript, and used it succesfully on Android. The inference takes about 1 sec.
Now, if I use the same model on iOS, the inference is about half a minute. I disable autograd, and run the model in inference mode.
Any idea what could cause such a big performance difference using the same model?
(I use 1.6.0 nightly build on Android, and 1.5.0 production build on iOS)
Ok, thank you! Meanwhile we managed to speed up the iOS inference. The thing is that on Android we scripted to model by calling jit.script(), and we tried to use this exact same model on iOS, which was slow. I tried another approach for converting to TorchScript by tracing the model’s execution with jit.trace, and for some reason the “traced model” performance on iOS was on par with the Android inference. Can it be also related to XNNPACK somehow?
Cool, it’s nice to hear the issue has been resolved. Short answer, no. The XNNPACK is our new computation kernels that has nothing to do with scripting. Yea, tracing is supposed to be faster.
Use traced boolean to only trace a single inference, not all the inferences.
Hope it helps.
If you need help with how to use these models on Android or iOS, let me know.
Hi Ahmed,
I successfully converted the model to pytorch script, but having some trouble using it on android platform. Can you guide me how can I use this u2net model, I mean how will we give it the input and take the output in android,
Thanks in advance …