Open jstaerk opened 6 months ago
I am encountering the same issue when running trainer.py
with my dataset. Here's the exception I received:
F:\Invoice\.venv\Lib\site-packages\keras\src\layers\layer.py:1383:` UserWarning: Layer 'attend_copy_parse_model' looks like it has unbuilt state, but Keras is not able to trace the layer `call()` in order to build it automatically. Possible causes:
1. The `call()` method of your layer may be crashing. Try to `__call__()` the layer eagerly on some test input first to see if it works. E.g. `x = np.random.random((3, 4)); y = layer(x)`
2. If the `call()` method is correct, then you may need to implement the `def build(self, input_shape)` method on your layer. It should create all variables used by the layer (e.g. by calling `layer.build()` on all its children layers).
Exception encountered: ''Cannot reshape a tensor with -1677721600 elements to shape [None, 65536, 128, 103] (-1728053248 elements).''
warnings.warn(
F:\Invoice\.venv\Lib\site-packages\keras\src\layers\layer.py:391: UserWarning: `build()` was called on layer 'attend_copy_parse_model', however the layer does not have a `build()` method implemented and it looks like it has unbuilt state. This will cause the layer to be marked as built, despite not being actually built, which may cause failures down the line. Make sure to implement a proper `build()` method.
warnings.warn(
Exception in thread Thread-1 (_train):
Traceback (most recent call last):
File "C:\Users\Mootu & Patlu\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1052, in _bootstrap_inner
self.run()
File "C:\Users\Mootu & Patlu\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 989, in run
self._target(*self._args, **self._kwargs)
File "F:\Invoice\invoicenet\gui\trainer.py", line 257, in _train
train_loss = model.train_step(next(train_iter))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\Invoice\.venv\Lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\MOOTU&~1\AppData\Local\Temp\__autograph_generated_filepi3s0otz.py", line 12, in tf__train_step
predictions = ag__.converted_call(ag__.ld(self).model, (ag__.ld(inputs),), dict(training=True), fscope)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\Invoice\.venv\Lib\site-packages\keras\src\utils\traceback_utils.py", line 122, in error_handler
raise e.with_traceback(filtered_tb) from None
^^^^^^^^^^^
File "F:\Invoice\invoicenet\acp\model.py", line 168, in call
memories = tf.sparse.reshape(memories,
^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: in user code:
File "F:\Invoice\invoicenet\acp\acp.py", line 86, in train_step *
predictions = self.model(inputs, training=True)
File "F:\Invoice\.venv\Lib\site-packages\keras\src\utils\traceback_utils.py", line 122, in error_handler **
raise e.with_traceback(filtered_tb) from None
File "F:\Invoice\invoicenet\acp\model.py", line 168, in call
memories = tf.sparse.reshape(memories,
ValueError: Exception encountered when calling AttendCopyParseModel.call().
Cannot reshape a tensor with -1677721600 elements to shape [None, 65536, 128, 103] (-1728053248 elements).
Arguments received by AttendCopyParseModel.call():
• inputs=('tf.Tensor(shape=(8, 128, 128, 4, 128, 103), dtype=float32)', 'tf.Tensor(shape=(8, 128, 128, 3), dtype=float32)', 'tf.Tensor(shape=(8, 128, 128), dtype=int32)', 'tf.Tensor(shape=(8, 128, 128), dtype=int32)', 'tf.Tensor(shape=(8, 128, 128), dtype=int32)', 'tf.Tensor(shape=(8, 128, 128), dtype=float32)', 'tf.Tensor(shape=(8, 128, 128, 4, 2), dtype=float32)')
• training=True
• mask=('None', 'None', 'None', 'None', 'None', 'None', `'None')
It seems the dataset might not be correctly structured or is missing important files. Could someone assist in providing a proper dataset or clarifying the issue?
Hi,
With this training data r2.zip I get the following Exception: