Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Invalid argument "add_trainable_weights" passed to K.function with Theano backend #21

Open
djsavic opened this issue Jan 4, 2022 · 0 comments

Comments

@djsavic
Copy link

djsavic commented Jan 4, 2022

Hi folks,

I've been trying to reproduce the results with python 3.7.7. After substituting training.py, i receive a ValueError. I aint an expert in low-level coding with keras and I am curios if it is worth to adapt the code for newer python versions. I am able to compile the model, but there are some problems with vade.fit()

keras - 2.3.1
theano - 1.0.5

vade.compile(optimizer=adam_nn,
loss=vae_loss,
add_trainable_weights=[theta_p,u_p,lambda_p],
add_optimizer=adam_gmm,
)

epoch_begin=EpochBegin()
vade.fit(X_train, X_train,
shuffle=True,
epochs=epoch,
batch_size=batch_size,
callbacks=[epoch_begin])


ValueError Traceback (most recent call last)
/tmp/ipykernel_3305833/3949754183.py in
3 epochs=epoch,
4 batch_size=batch_size,
----> 5 callbacks=[epoch_begin])

~/anaconda3/lib/python3.7/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
1211 else:
1212 fit_inputs = x + y + sample_weights
-> 1213 self._make_train_function()
1214 fit_function = self.train_function
1215

~/anaconda3/lib/python3.7/site-packages/keras/engine/training.py in _make_train_function(self)
331 updates=updates + metrics_updates,
332 name='train_function',
--> 333 **self._function_kwargs)
334
335 def _make_test_function(self):

~/anaconda3/lib/python3.7/site-packages/keras/backend/theano_backend.py in function(inputs, outputs, updates, **kwargs)
1451 for key in kwargs.keys():
1452 if not has_arg(theano.function, key, True):
-> 1453 _raise_invalid_arg(key)
1454 return Function(inputs, outputs, updates=updates, **kwargs)
1455

~/anaconda3/lib/python3.7/site-packages/keras/backend/theano_backend.py in _raise_invalid_arg(key)
1444 def _raise_invalid_arg(key):
1445 msg = 'Invalid argument "%s" passed to K.function with Theano backend' % key
-> 1446 raise ValueError(msg)
1447
1448

ValueError: Invalid argument "add_trainable_weights" passed to K.function with Theano backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant