Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

run.py fails with CNN model #29

Open
sechkova opened this issue Jan 28, 2022 · 1 comment
Open

run.py fails with CNN model #29

sechkova opened this issue Jan 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@sechkova
Copy link
Contributor

sechkova commented Jan 28, 2022

Describe the bug

Running run.py with the same dataset works with LSTM model but crashes when the chosen model is CNN.

Reproduction steps

python run.py test_data_annotated.csv test_data_raw.csv CNN Both

Traceback (most recent call last):
  File "~/ml-conversational-analytic-tool/ml-conversational-analytic-tool/run.py", line 92, in <module>
    run_res_constructive = run(args.annotated_filename, args.dataset_filename, 'Constructive', encodingType,
  File "~/ml-conversational-analytic-tool/ml-conversational-analytic-tool/run.py", line 47, in run
    model.makeModel(obs[0].shape)
  File "~/ml-conversational-analytic-tool/ml-conversational-analytic-tool/baseCNN.py", line 27, in makeModel
    self.model.add(keras.layers.MaxPooling1D(2))
  File "~/ml-conversational-analytic-tool/.env/lib/python3.10/site-packages/tensorflow/python/training/tracking/base.py", line 629, in _method_wrapper
    result = method(self, *args, **kwargs)
  File "~/ml-conversational-analytic-tool/.env/lib/python3.10/site-packages/keras/utils/traceback_utils.py", line 67, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "~/ml-conversational-analytic-tool/.env/lib/python3.10/site-packages/keras/backend.py", line 6065, in pool2d
    x = tf.compat.v1.nn.max_pool(
ValueError: Exception encountered when calling layer "max_pooling1d" (type MaxPooling1D).

Negative dimension size caused by subtracting 2 from 1 for '{{node max_pooling1d/MaxPool}} = MaxPool[T=DT_FLOAT, data_format="NHWC", explicit_paddings=[], ksize=[1, 2, 1, 1], padding="VALID", strides=[1, 2, 1, 1]](max_pooling1d/ExpandDims)' with input shapes: [?,1,1,32].

Call arguments received:
  • inputs=tf.Tensor(shape=(None, 1, 32), dtype=float32)
@sechkova sechkova added the bug Something isn't working label Jan 28, 2022
@sechkova
Copy link
Contributor Author

sechkova commented Feb 1, 2022

Update: After looking at the code and the arguments of the run.py command, it is possible to run successfully the above by adding -pad. Using both -roleRelevant -pad however still raises errors caused by some dimensionality mismatch.

It seems like either the data preprocessing steps need to be improved or the documentation has to describe strictly the expected format of the input data since it is not clear.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant