peterroelants / peterroelants.github.io

Blog
http://peterroelants.github.io/
Mozilla Public License 2.0
336 stars 181 forks source link

Problem when running gaussian-process-kernel-fitting.ipynb #20

Closed malsioufi closed 4 years ago

malsioufi commented 4 years ago

Thank you very much for the great repo! When I try to run the code in the notebook "gaussian-process-kernel-fitting.ipynb" in the "Tuning the hyperparameters" section I get the exception "RuntimeError: loss passed to Optimizer.compute_gradients should be a function when eager execution is enabled."

It seems to be related to tensorflow version, but I could not solve it myself. I tried the solution mention here: https://stackoverflow.com/questions/57858219/loss-passed-to-optimizer-compute-gradients-should-be-a-function-when-eager-exe However, that creates another problem.

my evironment is running under: python 3.6.9 tensorflow==2.1.0 tensorflow-estimator==2.1.0 tensorflow-probability==0.9.0

peterroelants commented 4 years ago

Regarding backward compatibility, the state of TensorFlow is a bit of a mess since the switch to 2.0. The easiest way would be to run the notebook in an environment with exactly the same versions as are printed at the bottom of the notebook.

I haven't spent time upgrading the code to 2.0. However, if you want to get it to work on 2.0 I would recommend to look at this post which seems to deal with the same issue of using the TF probability Gaussian Process module in TF 2.0: https://stackoverflow.com/q/58044469/919431

On Sat, 25 Jan 2020 at 10:51, Mohamad Alsioufi notifications@github.com wrote:

Thank you very much for the great repo! When I try to run the code in the notebook "gaussian-process-kernel-fitting.ipynb" in the "Tuning the hyperparameters" section I get the exception "RuntimeError: loss passed to Optimizer.compute_gradients should be a function when eager execution is enabled."

It seems to be related to tensorflow version, but I could not solve it myself. I tried the solution mention here:

https://stackoverflow.com/questions/57858219/loss-passed-to-optimizer-compute-gradients-should-be-a-function-when-eager-exe However, that creates another problem.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/peterroelants/peterroelants.github.io/issues/20?email_source=notifications&email_token=AAHIGNKI7O63H3M73DAXM3TQ7QKRJA5CNFSM4KLQGTF2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIVWZYQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHIGNJCQEM2HVKOTPLEEG3Q7QKRJANCNFSM4KLQGTFQ .