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

[BUG] SVAE problems with TypeError: You are passing KerasTensor #2194

Open
1 of 3 tasks
Peanpepu opened this issue Dec 9, 2024 · 0 comments
Open
1 of 3 tasks

[BUG] SVAE problems with TypeError: You are passing KerasTensor #2194

Peanpepu opened this issue Dec 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Peanpepu
Copy link

Peanpepu commented Dec 9, 2024

Description

In the example code examples/02_model_collaborative_filtering/standard_vae_deep_dive.ipynb I find an error like this one :
TypeError: You are passing KerasTensor(type_spec=TensorSpec(shape=(), dtype=tf.float32, name=None), name='Placeholder:0', description="created by layer 'tf.cast_2'"), an intermediate Keras symbolic input/output, to a TF API that does not allow registering custom dispatchers, such as tf.cond, tf.function, gradient tapes, or tf.map_fn. Keras Functional model construction only supports TF API calls that do support dispatching, such as tf.math.add or tf.reshape. Other APIs cannot be called directly on symbolic Kerasinputs/outputs. You can work around this limitation by putting the operation in a custom Keras layer call and calling that layer on this symbolic input/output.

I have tried changing the libraries it uses, but I found no solution. The error occurs in the snippet code
model_without_anneal = StandardVAE(n_users=train_data.shape[0], # Number of unique users in the training set
original_dim=train_data.shape[1], # Number of unique items in the training set
intermediate_dim=INTERMEDIATE_DIM,
latent_dim=LATENT_DIM,
n_epochs=EPOCHS,
batch_size=BATCH_SIZE,
k=TOP_K,
verbose=0,
seed=SEED,
save_path=WEIGHTS_PATH,
drop_encoder=0.5,
drop_decoder=0.5,
annealing=False,
beta=1.0
)
with Timer() as t:
model_without_anneal.fit(x_train=train_data,
x_valid=val_data,
x_val_tr=val_data_tr,
x_val_te=val_data_te_ratings, # with the original ratings
mapper=am_val
)

In which platform does it happen?

I am using VScode but I'm sure it is not the problem.

How do we replicate the issue?

Install pip install pandera==0.15.1 and execute the code.

Expected behavior (i.e. solution)

It should train the model without problems.

Willingness to contribute

  • Yes, I can contribute for this issue independently.
  • Yes, I can contribute for this issue with guidance from Recommenders community.
  • No, I cannot contribute at this time.

Other Comments

I am using others versions of libraries because installing those older versions gave me some problems. I'm using:

  • System version: 3.10.12 (main, Nov 6 2024, 20:22:13) [GCC 11.4.0]
  • Pandas version: 2.2.3
  • Tensorflow version: 2.13.0
  • Keras version: 2.13.1
    The libraries are used in the original code:
  • System version: 3.6.9 (default, Jul 17 2020, 12:50:27) [GCC 8.4.0]
  • Pandas version: 1.1.2
  • Tensorflow version: 2.2.0-rc1
  • Keras version: 2.3.1
@Peanpepu Peanpepu added the bug Something isn't working label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant