Probabilistic-Programming-and-Bayesian-Methods-for-Hackers icon indicating copy to clipboard operation
Probabilistic-Programming-and-Bayesian-Methods-for-Hackers copied to clipboard

Chapter 2 TFP. make_simple_step_size_update_policy requires positional argument (doesn't run on colab)

Open Liviodl opened this issue 6 years ago • 6 comments

Running from colab. The TFP make_simple_step_size_update_policy requires a positional argument. Providing a value for the parameter "num_adaptation_steps:, produces different errors.

Here is the original error message.

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer.

TypeError Traceback (most recent call last) in () 39 num_leapfrog_steps=leapfrog_steps, 40 step_size=step_size, ---> 41 step_size_update_fn=tfp.mcmc.make_simple_step_size_update_policy(), 42 state_gradients_are_stopped=True), 43 bijector=unconstraining_bijectors)

TypeError: make_simple_step_size_update_policy() missing 1 required positional argument: 'num_adaptation_steps'

Liviodl avatar Mar 11 '19 14:03 Liviodl

Run into same issue here in Google Colab. Which Tensorflow Probability Version is this code written in?

hrbzkm98 avatar Mar 11 '19 18:03 hrbzkm98

I was running the code in colab too. the tfp version is 0.6.0

Liviodl avatar Mar 11 '19 18:03 Liviodl

Attempt to leave the param 'num_adaptation_steps' to None. It runs forever.

hrbzkm98 avatar Mar 11 '19 18:03 hrbzkm98

Works when you set it to None in chapter 3. Did not work for chapter 2.

cmh325 avatar Mar 17 '19 16:03 cmh325

Same issue on my mac. tfp 0.6.0.

nrakocz avatar Apr 07 '19 06:04 nrakocz

I used the following parameters, based on the official TF documentation here, which ran in a reasonable minute or two:

            step_size_update_fn=tfp.mcmc.make_simple_step_size_update_policy(
                num_adaptation_steps=10, # chosen arbitrarily
                target_rate=0.75,
                decrement_multiplier=0.1, # increased from 0.01 to speed execution
                increment_multiplier=0.1, 
                step_counter=None),

There are very likely some better parameters to use, but this will get you through the chapter.

austinbrian avatar Apr 15 '19 17:04 austinbrian