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

Troubleshooting Concatenation in MultiGateMixtureOfExperts Model Training #2

Open
SEHABI-YOUSSOUF opened this issue Apr 22, 2024 · 1 comment

Comments

@SEHABI-YOUSSOUF
Copy link

hi sir i keep getting this error can you help me for instance give me exemple in collab of runing code please and thank you

----> 1 history =model.fit(x=sample_dataset, epochs=1)

2 frames
/tmp/__autograph_generated_filedpw8h24k.py in tf__call(self, inputs)
10 (cat_inputs, cont_inputs) = ag__.ld(inputs)
11 cat_embed = ag__.converted_call(ag__.ld(self).embedding_layer, (ag__.ld(cat_inputs),), None, fscope)
---> 12 combined_inputs = ag__.converted_call(ag__.ld(tf).concat, ([ag__.ld(cat_embed), ag__.ld(cont_inputs)],), dict(axis=-1), fscope)
13 out = ag__.converted_call(ag__.ld(self).mlp, (ag__.ld(combined_inputs),), None, fscope)
14 try:

ValueError: in user code:

File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training.py", line 1401, in train_function  *
    return step_function(self, iterator)
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training.py", line 1384, in step_function  **
    outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training.py", line 1373, in run_step  **
    outputs = model.train_step(data)
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training.py", line 1150, in train_step
    y_pred = self(x, training=True)
File "/usr/local/lib/python3.10/dist-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
File "/tmp/__autograph_generated_filedpw8h24k.py", line 12, in tf__call
    combined_inputs = ag__.converted_call(ag__.ld(tf).concat, ([ag__.ld(cat_embed), ag__.ld(cont_inputs)],), dict(axis=-1), fscope)

ValueError: Exception encountered when calling layer 'multi_gate_mixture_of_experts_23' (type MultiGateMixtureOfExperts).

in user code:

    File "<ipython-input-46-fb5e519901c9>", line 50, in call  *
        combined_inputs = tf.concat([cat_embed, cont_inputs], axis=-1)

    ValueError: Shape must be rank 3 but is rank 2 for '{{node multi_gate_mixture_of_experts_23/concat}} = ConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32](multi_gate_mixture_of_experts_23/embedding_25/embedding_lookup/Identity, IteratorGetNext:1, multi_gate_mixture_of_experts_23/concat/axis)' with input shapes: [?,2,64], [?,10], [].


Call arguments received by layer 'multi_gate_mixture_of_experts_23' (type MultiGateMixtureOfExperts):
  • inputs=('tf.Tensor(shape=(None, 2), dtype=int32)', 'tf.Tensor(shape=(None, 10), dtype=float32)')
@clabrugere
Copy link
Owner

Hello, the inputs are supposed to be a list/tuple of 2D tensors of shapes (batch size, num sparse features), (batch size, num dense features) and labels a 2D tensor of shape (batch size, num tasks). If you have only sparse or dense features you need to adapt the model accordingly.

I added this example notebook with random data. I hope that helps.

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

2 participants