Sure!
Epoch 1, Batch 1/231
ValueError Traceback (most recent call last)
Cell In[50], line 18
16 for (batch, (inp, tar)) in enumerate(dataset):
17 print(f’Epoch {epoch+1}, Batch {batch+1}/{number_of_batches}‘, end=’\r’)
—> 18 train_step(transformer, inp, tar)
20 print (f’Epoch {epoch+1}, Loss {train_loss.result():.4f}')
21 losses.append(train_loss.result())
File /usr/local/lib/python3.8/dist-packages/tensorflow/python/util/traceback_utils.py:153, in filter_traceback..error_handler(*args, **kwargs)
151 except Exception as e:
152 filtered_tb = _process_traceback_frames(e.traceback)
→ 153 raise e.with_traceback(filtered_tb) from None
154 finally:
155 del filtered_tb
File /tmp/autograph_generated_fileuu2pj3j4.py:15, in outer_factory..inner_factory..tf__train_step(model, inp, tar)
13 dec_padding_mask = ag.converted_call(ag__.ld(create_padding_mask), (ag__.ld(inp),), None, fscope)
14 with ag__.ld(tf).GradientTape() as tape:
—> 15 (predictions, ) = ag_.converted_call(ag__.ld(model), (ag__.ld(inp), ag__.ld(tar_inp), True, ag__.ld(enc_padding_mask), ag__.ld(look_ahead_mask), ag__.ld(dec_padding_mask)), None, fscope)
16 loss = ag__.converted_call(ag__.ld(masked_loss), (ag__.ld(tar_real), ag__.ld(predictions)), None, fscope)
17 gradients = ag__.converted_call(ag__.ld(tape).gradient, (ag__.ld(loss), ag__.ld(transformer).trainable_variables), None, fscope)
File /usr/local/lib/python3.8/dist-packages/keras/src/utils/traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
67 filtered_tb = _process_traceback_frames(e.traceback)
68 # To get the full stack trace, call:
69 # tf.debugging.disable_traceback_filtering()
—> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb
File /tmp/autograph_generated_file3f6zlr7g.py:12, in outer_factory..inner_factory..tf__call(self, input_sentence, output_sentence, training, enc_padding_mask, look_ahead_mask, dec_padding_mask)
10 retval = ag_.UndefinedReturnValue()
11 enc_output = ag__.converted_call(ag__.ld(self).encoder, (ag__.ld(input_sentence),), dict(training=ag__.ld(training), mask=ag__.ld(enc_padding_mask)), fscope)
—> 12 (dec_output, attention_weights) = ag__.converted_call(ag__.ld(self).decoder, (ag__.ld(output_sentence),), dict(enc_output=ag__.ld(enc_output), training=ag__.ld(training), look_ahead_mask=ag__.ld(look_ahead_mask), padding_mask=ag__.ld(dec_padding_mask)), fscope)
13 final_output = ag__.converted_call(ag__.ld(self).final_layer, (ag__.ld(dec_output),), None, fscope)
14 try:
File /tmp/autograph_generated_files9tlle_f.py:36, in outer_factory..inner_factory..tf__call(self, x, enc_output, training, look_ahead_mask, padding_mask)
34 i = ag.Undefined(‘i’)
35 block1 = ag__.Undefined(‘block1’)
—> 36 ag__.for_stmt(ag__.converted_call(ag__.ld(range), (ag__.ld(self).num_layers,), None, fscope), None, loop_body, get_state, set_state, (‘x’,), {‘iterate_names’: ‘i’})
37 try:
38 do_return = True
File /tmp/autograph_generated_files9tlle_f.py:30, in outer_factory..inner_factory..tf__call..loop_body(itr)
28 nonlocal x
29 i = itr
—> 30 (x, block1, block2) = ag.converted_call(ag__.ld(self).dec_layers[ag__.ld(i)], (ag__.ld(x),), dict(enc_output=ag__.ld(enc_output), training=ag__.ld(training), look_ahead_mask=ag__.ld(look_ahead_mask), padding_mask=ag__.ld(padding_mask)), fscope)
31 ag__.ld(attention_weights)[ag__.converted_call('decoder_layer{}block1_self_att’.format, ((ag_.ld(i) + 1),), None, fscope)] = ag__.ld(block1)
32 ag__.ld(attention_weights)[ag__.converted_call('decoder_layer{}block2_decenc_att’.format, ((ag_.ld(i) + 1),), None, fscope)] = ag__.ld(block2)
File /tmp/autograph_generated_file06gyjiza.py:28, in outer_factory..inner_factory..tf__call(self, x, enc_output, training, look_ahead_mask, padding_mask)
26 switch = ag.Undefined(‘switch’)
27 ag__.if_stmt((ag__.ld(look_ahead_mask) != None), if_body, else_body, get_state, set_state, (‘switch’,), 1)
—> 28 (mult_attn_out1, attn_weights_block1) = ag__.converted_call(ag__.ld(self).mha1, (), dict(query=ag__.ld(x), value=ag__.ld(x), attention_mask=ag__.ld(padding_mask), return_attention_scores=True, training=ag__.ld(training), use_causal_mask=ag__.ld(switch)), fscope)
29 Q1 = ag__.converted_call(ag__.ld(self).layernorm1, ((ag__.ld(mult_attn_out1) + ag__.ld(x)),), None, fscope)
30 (mult_attn_out2, attn_weights_block2) = ag__.converted_call(ag__.ld(self).mha2, (), dict(query=ag__.ld(Q1), value=ag__.ld(enc_output), key=ag__.ld(enc_output), attention_mask=ag__.ld(padding_mask), return_attention_scores=True, training=ag__.ld(training)), fscope)
ValueError: in user code:
File "/tmp/ipykernel_735/2638583919.py", line 20, in train_step *
predictions, _ = model(
File "/usr/local/lib/python3.8/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_file3f6zlr7g.py", line 12, in tf__call
(dec_output, attention_weights) = ag__.converted_call(ag__.ld(self).decoder, (ag__.ld(output_sentence),), dict(enc_output=ag__.ld(enc_output), training=ag__.ld(training), look_ahead_mask=ag__.ld(look_ahead_mask), padding_mask=ag__.ld(dec_padding_mask)), fscope)
File "/tmp/__autograph_generated_files9tlle_f.py", line 36, in tf__call
ag__.for_stmt(ag__.converted_call(ag__.ld(range), (ag__.ld(self).num_layers,), None, fscope), None, loop_body, get_state, set_state, ('x',), {'iterate_names': 'i'})
File "/tmp/__autograph_generated_files9tlle_f.py", line 30, in loop_body
(x, block1, block2) = ag__.converted_call(ag__.ld(self).dec_layers[ag__.ld(i)], (ag__.ld(x),), dict(enc_output=ag__.ld(enc_output), training=ag__.ld(training), look_ahead_mask=ag__.ld(look_ahead_mask), padding_mask=ag__.ld(padding_mask)), fscope)
File "/tmp/__autograph_generated_file06gyjiza.py", line 28, in tf__call
(mult_attn_out1, attn_weights_block1) = ag__.converted_call(ag__.ld(self).mha1, (), dict(query=ag__.ld(x), value=ag__.ld(x), attention_mask=ag__.ld(padding_mask), return_attention_scores=True, training=ag__.ld(training), use_causal_mask=ag__.ld(switch)), fscope)
ValueError: Exception encountered when calling layer 'transformer_2' (type Transformer).
in user code:
File "/tmp/ipykernel_735/2648137580.py", line 57, in call *
dec_output, attention_weights = self.decoder(
File "/usr/local/lib/python3.8/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_files9tlle_f.py", line 36, in tf__call
ag__.for_stmt(ag__.converted_call(ag__.ld(range), (ag__.ld(self).num_layers,), None, fscope), None, loop_body, get_state, set_state, ('x',), {'iterate_names': 'i'})
File "/tmp/__autograph_generated_files9tlle_f.py", line 30, in loop_body
(x, block1, block2) = ag__.converted_call(ag__.ld(self).dec_layers[ag__.ld(i)], (ag__.ld(x),), dict(enc_output=ag__.ld(enc_output), training=ag__.ld(training), look_ahead_mask=ag__.ld(look_ahead_mask), padding_mask=ag__.ld(padding_mask)), fscope)
File "/tmp/__autograph_generated_file06gyjiza.py", line 28, in tf__call
(mult_attn_out1, attn_weights_block1) = ag__.converted_call(ag__.ld(self).mha1, (), dict(query=ag__.ld(x), value=ag__.ld(x), attention_mask=ag__.ld(padding_mask), return_attention_scores=True, training=ag__.ld(training), use_causal_mask=ag__.ld(switch)), fscope)
ValueError: Exception encountered when calling layer 'decoder_4' (type Decoder).
in user code:
File "/tmp/ipykernel_735/3237182596.py", line 66, in call *
x, block1, block2 = self.dec_layers[i](
File "/usr/local/lib/python3.8/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_file06gyjiza.py", line 28, in tf__call
(mult_attn_out1, attn_weights_block1) = ag__.converted_call(ag__.ld(self).mha1, (), dict(query=ag__.ld(x), value=ag__.ld(x), attention_mask=ag__.ld(padding_mask), return_attention_scores=True, training=ag__.ld(training), use_causal_mask=ag__.ld(switch)), fscope)
ValueError: Exception encountered when calling layer 'decoder_layer_23' (type DecoderLayer).
in user code:
File "/tmp/ipykernel_735/470627807.py", line 61, in call *
mult_attn_out1, attn_weights_block1 = self.mha1(
File "/usr/local/lib/python3.8/dist-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler **
raise e.with_traceback(filtered_tb) from None
ValueError: Exception encountered when calling layer 'multi_head_attention_57' (type MultiHeadAttention).
Dimensions must be equal, but are 150 and 49 for '{{node transformer_2/decoder_4/decoder_layer_23/multi_head_attention_57/and}} = LogicalAnd[](transformer_2/decoder_4/decoder_layer_23/multi_head_attention_57/Cast, transformer_2/decoder_4/decoder_layer_23/multi_head_attention_57/MatrixBandPart)' with input shapes: [64,1,150], [1,49,49].
Call arguments received by layer 'multi_head_attention_57' (type MultiHeadAttention):
• query=tf.Tensor(shape=(64, 49, 128), dtype=float32)
• value=tf.Tensor(shape=(64, 49, 128), dtype=float32)
• key=None
• attention_mask=tf.Tensor(shape=(64, 1, 150), dtype=float32)
• return_attention_scores=True
• training=True
• use_causal_mask=True
Call arguments received by layer 'decoder_layer_23' (type DecoderLayer):
• x=tf.Tensor(shape=(64, 49, 128), dtype=float32)
• enc_output=tf.Tensor(shape=(64, 150, 128), dtype=float32)
• training=True
• look_ahead_mask=tf.Tensor(shape=(1, 49, 49), dtype=float32)
• padding_mask=tf.Tensor(shape=(64, 1, 150), dtype=float32)
Call arguments received by layer 'decoder_4' (type Decoder):
• x=tf.Tensor(shape=(64, 49), dtype=int32)
• enc_output=tf.Tensor(shape=(64, 150, 128), dtype=float32)
• training=True
• look_ahead_mask=tf.Tensor(shape=(1, 49, 49), dtype=float32)
• padding_mask=tf.Tensor(shape=(64, 1, 150), dtype=float32)
Call arguments received by layer 'transformer_2' (type Transformer):
• input_sentence=tf.Tensor(shape=(64, 150), dtype=int32)
• output_sentence=tf.Tensor(shape=(64, 49), dtype=int32)
• training=True
• enc_padding_mask=tf.Tensor(shape=(64, 1, 150), dtype=float32)
• look_ahead_mask=tf.Tensor(shape=(1, 49, 49), dtype=float32)
• dec_padding_mask=tf.Tensor(shape=(64, 1, 150), dtype=float32)