Image-Caption-Generator icon indicating copy to clipboard operation
Image-Caption-Generator copied to clipboard

error on training

Open dbswnsdud123 opened this issue 6 years ago • 3 comments

i'm using a google colab. when i start !python train_val.py

Traceback (most recent call last): File "train_val.py", line 86, in verbose=1) File "/usr/local/lib/python3.6/dist-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1658, in fit_generator initial_epoch=initial_epoch) File "/usr/local/lib/python3.6/dist-packages/keras/engine/training_generator.py", line 103, in fit_generator callbacks._call_begin_hook('train') File "/usr/local/lib/python3.6/dist-packages/keras/callbacks.py", line 103, in _call_begin_hook self.on_train_begin() File "/usr/local/lib/python3.6/dist-packages/keras/callbacks.py", line 219, in on_train_begin callback.on_train_begin(logs) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/callbacks.py", line 905, in on_train_begin if self.model._in_multi_worker_mode(): AttributeError: 'Model' object has no attribute '_in_multi_worker_mode'

dbswnsdud123 avatar Oct 12 '19 19:10 dbswnsdud123

Please make sure that you're using the right version of libraries as mentioned in the requirements section in Readme.md I think this error is due to version mismatch as Keras & Tensorflow API is constantly changing and my code was tested on Tensorflow - 1.13.1 & Keras - 2.2.4. P.S. I also used Google Colab for the project so there shouldn't be an issue provided that you have the right version of libraries.

dabasajay avatar Nov 22 '19 12:11 dabasajay

This error arises due to the mixed usage of Keras API and tensorflow.keras API. I was able to resolve the error by changing from tensorflow.keras.callbacks import ModelCheckpoint to from keras.callbacks import ModelCheckpoint in the train_val.py file.

hggit avatar Jul 01 '20 08:07 hggit

This error arises due to the mixed usage of Keras API and tensorflow.keras API. I was able to resolve the error by changing from tensorflow.keras.callbacks import ModelCheckpoint to from keras.callbacks import ModelCheckpoint in the train_val.py file.

In my code I used only keras. rather than tensorflow.keras. then also I am getting error:

tensorflow.python.framework.errors_impl.invalidargumenterror graph execution error

what should I do please tell me

dipendrachouhan007 avatar Feb 07 '22 07:02 dipendrachouhan007