Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Please construct your Model instance in graph mode or call Model.predict with eager mode enabled. #30

Open
momame opened this issue Jun 23, 2021 · 0 comments

Comments

@momame
Copy link

momame commented Jun 23, 2021

_Traceback (most recent call last)

File "C:\Users\mm\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 2088, in __call__

return self.wsgi_app(environ, start_response)

File "C:\Users\mm\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 2073, in wsgi_app

response = self.handle_exception(e)

File "C:\Users\mm\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 2070, in wsgi_app

response = self.full_dispatch_request()

File "C:\Users\mm\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 1515, in full_dispatch_request

rv = self.handle_user_exception(e)

File "C:\Users\mm\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 1513, in full_dispatch_request

rv = self.dispatch_request()

File "C:\Users\mm\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 1499, in dispatch_request

return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)

File "C:\Users\mm\Downloads\image-to-image-search\server.py", line 77, in search

query = gencap.get_caption(uploaded_img_path)

File "C:\Users\mm\Downloads\image-to-image-search\capgen.py", line 55, in get_caption

feat = self.get_image_feature(file)

File "C:\Users\mm\Downloads\image-to-image-search\capgen.py", line 38, in get_image_feature

feats = np.transpose(self.visual_model.predict(self.convert_img_to_vector(img_path)))

File "C:\Users\mm\AppData\Roaming\Python\Python39\site-packages\tensorflow\python\keras\engine\training.py", line 1671, in predict

version_utils.disallow_legacy_graph('Model', 'predict')

File "C:\Users\mm\AppData\Roaming\Python\Python39\site-packages\tensorflow\python\keras\utils\version_utils.py", line 130, in disallow_legacy_graph

raise ValueError(error_msg)_


ValueError: Calling `Model.predict` in graph mode is not supported when the `Model` instance was constructed with eager mode enabled. Please construct your `Model` instance in graph mode or call `Model.predict` with eager mode enabled.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant