Reputation: 53
there's is a bug while running the Tensorflow code, the error code appears like this:
Traceback (most recent call last):
File "app.py", line 76, in <module>
model = deepmoji_emojis(maxlen, PRETRAINED_PATH)
File "/home/lifeofpy/LifeofPy/AI Photographer Project/Text-to-Color/deepmoji/model_def.py", line 35, in deepmoji_emojis
model._make_predict_function()
AttributeError: 'Functional' object has no attribute '_make_predict_function
and the file app.py is like this:
# print('Loading model from {}.'.format(PRETRAINED_PATH))
model = deepmoji_emojis(maxlen, PRETRAINED_PATH)
model.summary()
model._make_predict_function()
I think the error message is occured by the function 'model._make_predict_function', I would appreciate any comments on this issue. Thanks!
Upvotes: 1
Views: 3701
Reputation: 51
Use: model.make_predict_function()
instead of: model._make_predict_function()
Upvotes: 5
Reputation: 142651
I tried to find _make_predict_function()
with Google and it seems it was private function in old Keras
in keras.engine.training.py but now Keras
is part of tensorflow
and function was removed from code. I can't find _make_predict_function()
in tensorflow.keras.engine.training.py
Some old posts suggest to use model.predict()
instead of model._make_predict_function()
before threads but other posts suggest to duplicate model
for every thread. But maybe new code in tensorflow
resolved problem with running it in threads and maybe it doesn't need this function any more.
Upvotes: 3