PyStan vs TFP

42 views
Skip to first unread message

Sarthak Kala

unread,
Apr 8, 2022, 1:49:23 AM4/8/22
to TensorFlow Probability
Tried running a regression model with both TFP and PyStan. PyStan is atleast 10x faster. Is there a reason why? Or am I doing something wrong ??

rif

unread,
Apr 8, 2022, 2:22:33 AM4/8/22
to Sarthak Kala, TensorFlow Probability
Without knowing more it's hard to say. The first thing to check is usually how your TFP code is running --- for instance if it's in eager mode it's going to be very slow. Can you share your code?

On Thu, Apr 7, 2022 at 10:49 PM Sarthak Kala <sarthak...@gmail.com> wrote:
Tried running a regression model with both TFP and PyStan. PyStan is atleast 10x faster. Is there a reason why? Or am I doing something wrong ??

--
You received this message because you are subscribed to the Google Groups "TensorFlow Probability" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfprobabilit...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfprobability/a8d9bab2-e3ac-43fd-81d5-4e4fd363aaadn%40tensorflow.org.

Sarthak Kala

unread,
Apr 8, 2022, 4:14:04 PM4/8/22
to TensorFlow Probability, Rif A. Saurous, TensorFlow Probability, Sarthak Kala

Christiaan Swanepoel

unread,
Apr 9, 2022, 5:16:59 AM4/9/22
to TensorFlow Probability, sarthak...@gmail.com, Rif A. Saurous, TensorFlow Probability
You are running your code in eager mode, which will be substantially slower. I ran your code in function mode and observed a ~30x speedup.
You can use function mode by wrapping your call to `tfp.mcmc.sample_chain` in a function without arguments and adding the `tf.function` decorator.
Reply all
Reply to author
Forward
0 new messages