Theano (compilation or execution) takes too much time to do one simulation

In my script, I perform a fitting with lmfit the fitting routine called 80 times the solver to compare calculation with experimental (observed data) this took 20 seconds.

After the fitting, I want to execute PyMC3 using theano to determine the posterior distributions for each model parameter. Here I am using pm.Slice() and each call is demanding 10 seconds…

I want to know if this has already happened before, and how to speed up?


Ps.: My function has a try, except statement. The “failed” case returns some vale out of sense, to avoid digging in that samples