gagneurlab / MMSplice_MTSplice

Tissue-specific variant effect predictions on splicing
MIT License
39 stars 21 forks source link

model predictions in google collab #56

Closed pablo-baeza closed 2 years ago

pablo-baeza commented 2 years ago

Description

Hi, I am trying to run the google collab notebook with the test vcf data and the notebook seems to crash once you try to make the predictions (so after the model is built). I run this command:

predict_save(model, dl, output_csv, pathogenicity=True, splicing_efficiency=True)

This is what the output looks like:

0it [00:00, ?it/s]

WARNING:tensorflow:Model was constructed with shape (None, None, 4) for input KerasTensor(type_spec=TensorSpec(shape=(None, None, 4), dtype=tf.float32, name='input_5'), name='input_5', description="created by layer 'input_5'"), but it was called on an input with incompatible shape (32,).

0it [00:00, ?it/s]

---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

<ipython-input-58-81048a45f553> in <module>()
----> 1 predict_save(model, dl, output_csv, pathogenicity=True, splicing_efficiency=True)

6 frames

/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs)
   1127           except Exception as e:  # pylint:disable=broad-except
   1128             if hasattr(e, "ag_error_metadata"):
-> 1129               raise e.ag_error_metadata.to_exception(e)
   1130             else:
   1131               raise

ValueError: in user code:

    File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1621, in predict_function  *
        return step_function(self, iterator)
    File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1611, in step_function  **
        outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1604, in run_step  **
        outputs = model.predict_step(data)
    File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1572, in predict_step
        return self(x, training=False)
    File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
        raise e.with_traceback(filtered_tb) from None
    File "/usr/local/lib/python3.7/dist-packages/keras/engine/input_spec.py", line 227, in assert_input_compatibility
        raise ValueError(f'Input {input_index} of layer "{layer_name}" '

    ValueError: Exception encountered when calling layer "model_5" (type Functional).

    Input 0 of layer "conv" is incompatible with the layer: expected min_ndim=3, found ndim=1. Full shape received: (32,)

    Call arguments received:
      • inputs=tf.Tensor(shape=(32,), dtype=string)
      • training=False
      • mask=None
pablo-baeza commented 2 years ago

just wanted to add that the solution proposed in issue #54 solves this problem. Since I saw that you are already working on that, I will close this issue. Thanks and apologies for the trouble!