1

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!

5
  • what is deepmoji_emojis ? Maybe it doesn't give model but something different. Commented Sep 11, 2020 at 5:18
  • @furas github.com/hon9g/Text-to-Color/blob/master/app.py it returns a model... Commented Sep 11, 2020 at 7:10
  • in what tutorial did you find _make_predict_function() ? I tried to find it with Google and it seems it was private function in Keras but probably it was removed from code. Commented Sep 11, 2020 at 8:06
  • @furas yeah I tried to find _make_predict_function() too, but I wasn't able to find it. Maybe it was an old version of Keras code, and switched to another code. So I'm wondering if there's a new version of _make_predict_function() Commented Sep 11, 2020 at 8:22
  • As I wrote in answer - Some old posts suggest to use model.predict() ... Commented Feb 4, 2021 at 11:47

2 Answers 2

5

Use: model.make_predict_function()

instead of: model._make_predict_function()

Sign up to request clarification or add additional context in comments.

Comments

3

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.