Open gooooney opened 8 months ago
Hello gooney
- indeed the code is not working any more with the latest version of tensorflow
and tensorflow_probability
.
The code was tested using tensorflow 2.4.0 and tensorflow_probability 0.12.1.
I tried to run the code with the earliest available versions of tf/tfp in google colab (2.8 and 0.15 respectively) but the issue persists.
I hope that helps.
I appreciate your reply, but I encountered some problems while setting up the environment. It seems that the latest version of numpy is not compatible with tensorflow 2.4.0. Could you provide a requirements.txt file for running this code? It would be very helpful. Thank you.
Hello, I encountered some issues when running your code. Below is the error message. I think it might be due to some configuration or environment problems. May I ask what your environment configuration was when you ran this code? Thank you.
TypeError Traceback (most recent call last) Cell In[40], line 4 2 cond_size = w_norm.shape[-1] 3 nlatent = 30 ----> 4 cvae = CVAEModel( cond_size,input_dims, nlatent, layer_width=300) 7 def eval_loss(X,W, beta = 0.1 ): 8 Xhat ,z_out, kl_loss = cvae.vae_model([X,W])
Cell In[35], line 70 66 vae_params = self.encoder(X_in) 68 posterior_out = posterior(tf.keras.layers.concatenate(vae_params)) ---> 70 kl_div = tfd.kl_divergence(tfd.MultivariateNormalDiag(loc = vae_params[0], scale_diag=vae_params[1] ), prior) 72 self.posterior_out = posterior_out 74 dec_output = input_dims
File c:\Users\A\anaconda3\envs\BB\lib\site-packages\tensorflow_probability\python\distributions\kullback_leibler.py:100, in kl_divergence(distribution_a, distribution_b, allow_nan_stats, name) 98 with distribution_a._name_and_control_scope(name + "_a"): 99 with distribution_b._name_and_control_scope(name + "_b"): --> 100 kl_t = kl_fn(distribution_a, distribution_b, name=name) 101 if allow_nan_stats: 102 return kl_t
File c:\Users\A\anaconda3\envs\BB\lib\site-packages\tensorflow_probability\python\distributions\mvn_linear_operator.py:397, in _kl_brute_force(a, b, name) 391 else: ... ---> 70 raise e.with_traceback(filtered_tb) from None 71 finally: 72 del filtered_tb
TypeError: Dimension value must be integer or None or have an index method, got value '<attribute 'shape' of 'numpy.generic' objects>' with type '<class 'getset_descriptor'>'