MiraldiLab / maxATAC

Transcription Factor Binding Prediction from ATAC-seq and scATAC-seq with Deep Neural Networks
Apache License 2.0
25 stars 8 forks source link

Issue with plotting models. Potential clash between keras and tf.keras modules #40

Closed dlab-arp closed 3 years ago

dlab-arp commented 3 years ago

Lmod is automatically replacing "intel/19.0.5" with "gnu/9.1.0".

Due to MODULEPATH changes, the following have been reloaded: 1) mvapich2/2.3.3

mkdir: cannot create directory ‘/fs/project/PES0738/maxatac_predictions/20210714_11TF_Dense_DCNN_binary/ARNT’: File exists /users/PES0698/ucn2213/.conda/envs/tf1_env/lib/python3.6/site-packages/sklearn/ensemble/weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release. from numpy.core.umath_tests import inner1d [2021-07-14 13:43:47,730] Set up model parameters [2021-07-14 13:43:49,839] Import training regions [2021-07-14 13:44:00,829] Initialize data generator [2021-07-14 13:44:00,829] Fit model


                      /\|__   __|/\   / ____|

_ / \ | | / \ | |
| ' ` \ / ` \ \/ / / /\ \ | | / /\ | |
| | | | | | (
| |> < / __
| |/ \ | || || ||_,//_\// __// __
|

Epoch 1/2

1/5 [=====>........................] - ETA: 5:22 - loss: 1.0314 - dice_coef: 0.0130 - acc: 0.0070 - precision: 0.0065 - recall: 0.5245 - pearson: -0.0026 - spearman: 0.1058 2/5 [===========>..................] - ETA: 2:06 - loss: 0.9559 - dice_coef: 0.0151 - acc: 0.0120 - precision: 0.0073 - recall: 0.4647 - pearson: -0.0032 - spearman: 0.1114 3/5 [=================>............] - ETA: 59s - loss: 0.8879 - dice_coef: 0.0189 - acc: 0.0137 - precision: 0.0091 - recall: 0.4469 - pearson: 0.0040 - spearman: 0.1114  4/5 [=======================>......] - ETA: 23s - loss: 0.8297 - dice_coef: 0.0196 - acc: 0.0140 - precision: 0.0098 - recall: 0.4444 - pearson: 0.0129 - spearman: 0.1161 5/5 [==============================] - 141s 28s/step - loss: 0.7760 - dice_coef: 0.0207 - acc: 0.0144 - precision: 0.0105 - recall: 0.4188 - pearson: 0.0161 - spearman: 0.1152 - val_loss: 0.6691 - val_dice_coef: 0.0170 - val_acc: 0.1248 - val_precision: 0.0263 - val_recall: 7.1582e-04 - val_pearson: -0.0986 - val_spearman: 0.1761 Epoch 2/2

1/5 [=====>........................] - ETA: 16s - loss: 0.4816 - dice_coef: 0.0319 - acc: 0.0290 - precision: 0.0203 - recall: 0.2234 - pearson: 0.0181 - spearman: 0.1182 2/5 [===========>..................] - ETA: 12s - loss: 0.4511 - dice_coef: 0.0258 - acc: 0.0280 - precision: 0.0175 - recall: 0.2052 - pearson: 0.0107 - spearman: 0.1162 3/5 [=================>............] - ETA: 8s - loss: 0.4244 - dice_coef: 0.0258 - acc: 0.0277 - precision: 0.0176 - recall: 0.1785 - pearson: 0.0092 - spearman: 0.1148  4/5 [=======================>......] - ETA: 4s - loss: 0.4041 - dice_coef: 0.0275 - acc: 0.0272 - precision: 0.0195 - recall: 0.1599 - pearson: 0.0083 - spearman: 0.1149 5/5 [==============================] - 52s 10s/step - loss: 0.3814 - dice_coef: 0.0268 - acc: 0.0272 - precision: 0.0197 - recall: 0.1485 - pearson: 0.0095 - spearman: 0.1158 - val_loss: 0.5773 - val_dice_coef: 0.0206 - val_acc: 0.0650 - val_precision: 0.0000e+00 - val_recall: 0.0000e+00 - val_pearson: -0.0592 - val_spearman: nan /users/PES0698/ucn2213/.conda/envs/tf1_env/lib/python3.6/site-packages/numpy/lib/function_base.py:2559: RuntimeWarning: invalid value encountered in true_divide c /= stddev[:, None] /users/PES0698/ucn2213/.conda/envs/tf1_env/lib/python3.6/site-packages/numpy/lib/function_base.py:2560: RuntimeWarning: invalid value encountered in true_divide c /= stddev[None, :] [2021-07-14 13:47:28,840] Plot and save results Traceback (most recent call last): File "/users/PES0698/ucn2213/.conda/envs/tf1_env/bin/maxatac", line 7, in exec(compile(f.read(), file, 'exec')) File "/users/PES0698/ucn2213/Project-Repos/maxATAC/maxatac/bin/maxatac", line 24, in sys.exit(main(sys.argv[1:])) File "/users/PES0698/ucn2213/Project-Repos/maxATAC/maxatac/bin/maxatac", line 20, in main args.func(args) File "/users/PES0698/ucn2213/Project-Repos/maxATAC/maxatac/analyses/train.py", line 142, in run_training export_model_structure(maxatac_model.nn_model, maxatac_model.results_location) File "/users/PES0698/ucn2213/Project-Repos/maxATAC/maxatac/utilities/plot.py", line 17, in export_model_structure suffix + ext File "/users/PES0698/ucn2213/.conda/envs/tf1_env/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 240, in plot_model expand_nested, dpi) File "/users/PES0698/ucn2213/.conda/envs/tf1_env/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 169, in model_to_dot for inbound_layer in node.inbound_layers: TypeError: 'InputLayer' object is not iterable

FaizRizvi commented 3 years ago

This is an error that I have received in the past, it should be a tensorflow 2 error.

First make sure we are on the right branch (tf1). Then check if the environment has been installed correctly (i.e. tensorflow 1.14)

If both of these checkout then go to plot.py and import plot_model as follows:

from tensorflow.keras.utils import plot_model