Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong path separator in error message when saved model does not exist (in keras.models.load_model) #44739

Closed
spopovru opened this issue Nov 10, 2020 · 5 comments
Assignees
Labels
comp:keras Keras related issues TF 2.3 Issues related to TF 2.3 type:bug Bug

Comments

@spopovru
Copy link
Contributor

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10 Home Single Language (build 19042.610)
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): v2.3.0-54-gfcc4b966f1 2.3.1
  • Python version: 3.8.6
  • CUDA/cuDNN version: 10.1
  • GPU model and memory: GeForce RTX 2070 SUPER 8 GB

Current behavior
When I use function keras.models.load_model with incorrect path, I catch IOError:
OSError: SavedModel file does not exist at: C:\IncorrectPathToSavedModel/{saved_model.pbtxt|saved_model.pb}
Because I use Windows, path separator "/" is incorrect, and when I view code of parse_saved_model in "\tensorflow\python\saved_model\loader_impl.py" I see hardcoded symbol in error text definition.

Expected behavior
Path separator should be recived from os.path.sep, for example in Windows this error message must be:
OSError: SavedModel file does not exist at: C:\IncorrectPathToSavedModel\{saved_model.pbtxt|saved_model.pb}
in Linux:
OSError: SavedModel file does not exist at: ~/IncorrectPathToSavedModel/{saved_model.pbtxt|saved_model.pb}

Standalone code to reproduce the issue

from tensorflow import keras
model_dir = 'C:\\IncorrectPathToSavedModel'
model = keras.models.load_model(model_dir)
@sachinprasadhs
Copy link
Contributor

Was able to reproduce your issue in Tf Nightly 2.6.0-dev20210530, please find the gist here. Thanks!

@jvishnuvardhan
Copy link
Contributor

@spopovru Looks like this was resolved by your PR. Can we close this issue? Thanks!

Error with TF2.5

OSError: SavedModel file does not exist at: C:\IncorrectPathToSavedModel/{saved_model.pbtxt|saved_model.pb}

Error with tf-nightly

OSError: No file or directory found at C:\IncorrectPathToSavedModel

@jvishnuvardhan jvishnuvardhan added stat:awaiting response Status - Awaiting response from author and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Feb 1, 2022
@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you.

@google-ml-butler google-ml-butler bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Feb 8, 2022
@spopovru
Copy link
Contributor Author

spopovru commented Feb 8, 2022

@spopovru Looks like this was resolved by your PR. Can we close this issue? Thanks!

Error with TF2.5

OSError: SavedModel file does not exist at: C:\IncorrectPathToSavedModel/{saved_model.pbtxt|saved_model.pb}

Error with tf-nightly

OSError: No file or directory found at C:\IncorrectPathToSavedModel

Yes, this issue may be closed.
Thank you!

@google-ml-butler google-ml-butler bot removed stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author labels Feb 8, 2022
@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:keras Keras related issues TF 2.3 Issues related to TF 2.3 type:bug Bug
Projects
None yet
Development

No branches or pull requests

4 participants