python code using GRU encoder and BiLSTM decoder rnn with attention layer to translate…
- User
python code using GRU encoder and BiLSTM decoder rnn with attention layer to translate English text to Arabic text by splitting data from file into train, validate and test then Tokenize the sentences and convert them into numerical representations ,Pad or truncate the sentences to a fixed length and use test data to get example translation from test
- Assistant
- User
Traceback (most recent call last): File "D:\PHD Papers\scientific translation\GPT\BiLSTM witth Attention\GRU attention Bi.py", line 102, in model = build_model(vocab_size, hidden_units) File "D:\PHD Papers\scientific translation\GPT\BiLSTM witth Attention\GRU attention Bi.py", line 57, in build_model attention = Attention()([decoder_bilstm, encoder_output]) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\utils\traceback_utils.py", line 70, in error_handler raise e.with_traceback(filtered_tb) from None File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\framework\ops.py", line 1969, in _create_c_op raise ValueError(e.message) ValueError: Exception encountered when calling layer "attention" (type Attention).
Dimensions must be equal, but are 512 and 256 for '{{node attention/MatMul}} = BatchMatMulV2[T=DT_FLOAT, adj_x=false, adj_y=true](Placeholder, Placeholder_1)' with input shapes: [?,?,512], [?,256].
Call arguments received by layer "attention" (type Attention): • inputs=['tf.Tensor(shape=(None, None, 512), dtype=float32)', 'tf.Tensor(shape=(None, 256), dtype=float32)'] • mask=None • training=None • return_attention_scores=False • use_causal_mask=False
- Assistant
- User
Traceback (most recent call last): File "D:\PHD Papers\scientific translation\GPT\BiLSTM witth Attention\GRU attention Bi.py", line 102, in model = build_model(vocab_size, hidden_units) File "D:\PHD Papers\scientific translation\GPT\BiLSTM witth Attention\GRU attention Bi.py", line 57, in build_model attention = Attention(use_scale=True)([decoder_bilstm, encoder_output]) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\utils\traceback_utils.py", line 70, in error_handler raise e.with_traceback(filtered_tb) from None File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\framework\ops.py", line 1969, in _create_c_op raise ValueError(e.message) ValueError: Exception encountered when calling layer "attention" (type Attention).
Dimensions must be equal, but are 512 and 256 for '{{node attention/MatMul}} = BatchMatMulV2[T=DT_FLOAT, adj_x=false, adj_y=true](Placeholder, Placeholder_1)' with input shapes: [?,?,512], [?,256].
Call arguments received by layer "attention" (type Attention): • inputs=['tf.Tensor(shape=(None, None, 512), dtype=float32)', 'tf.Tensor(shape=(None, 256), dtype=float32)'] • mask=None • training=None • return_attention_scores=False • use_causal_mask=False
- Assistant