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

Bug: hub.load not working in provided example #879

Closed
roomrys opened this issue Mar 16, 2023 · 2 comments
Closed

Bug: hub.load not working in provided example #879

roomrys opened this issue Mar 16, 2023 · 2 comments
Assignees
Labels

Comments

@roomrys
Copy link

roomrys commented Mar 16, 2023

What happened?

I ran the example code on the site and received an error that the model contains neither a .pb or .pbtxt. Previously this was working fine for me, so I downgraded my version of tensorflow_hub to 0.12.0, but then I received an OSError.

Relevant code

import tensorflow_hub as hub
model = hub.load("https://tfhub.dev/google/movenet/singlepose/lightning/4")

Relevant log output

For tensorflow_hub 0.13.0:
(sleap_cattrs) λ conda list tensorflow
# packages in environment at C:\Users\TalmoLab\miniconda3\envs\sleap_cattrs:
#
# Name                    Version                   Build  Channel
tensorflow                2.8.4                    pypi_0    pypi
tensorflow-estimator      2.8.0                    pypi_0    pypi
tensorflow-hub            0.13.0                   pypi_0    pypi
tensorflow-io-gcs-filesystem 0.31.0                   pypi_0    pypi

D:\social-leap-estimates-animal-poses\pull-requests\sleap-fork(liezl/dependency_update -> origin)
(sleap_cattrs) λ python -c "import tensorflow_hub as hub; model = hub.load('https://tfhub.dev/google/movenet/singlepose/lightning/4')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\TalmoLab\miniconda3\envs\sleap_cattrs\lib\site-packages\tensorflow_hub\module_v2.py", line 107, in load
    raise ValueError("Trying to load a model of incompatible/unknown type. "
ValueError: Trying to load a model of incompatible/unknown type. 'C:\Users\TalmoLab\AppData\Local\Temp\tfhub_modules\29fb93a7b6cbd61f33bf8c76777682f0a9b06839' contains neither 'saved_model.pb' nor 'saved_model.pbtxt'.


For tensorflow_hub 0.12.0:
(sleap_tfh) λ conda list tensorflow
# packages in environment at C:\Users\TalmoLab\miniconda3\envs\sleap_tfh:
#
# Name                    Version                   Build  Channel
tensorflow                2.8.4                    pypi_0    pypi
tensorflow-estimator      2.8.0                    pypi_0    pypi
tensorflow-hub            0.12.0                   pypi_0    pypi
tensorflow-io-gcs-filesystem 0.31.0                   pypi_0    pypi

D:\social-leap-estimates-animal-poses\pull-requests\sleap-fork(liezl/dependency_update -> origin)
(sleap_tfh) λ python -c "import tensorflow_hub as hub; model = hub.load('https://tfhub.dev/google/movenet/singlepose/lightning/4')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\TalmoLab\miniconda3\envs\sleap_tfh\lib\site-packages\tensorflow_hub\module_v2.py", line 106, in load
    obj = tf.compat.v1.saved_model.load_v2(module_path, tags=tags)
  File "C:\Users\TalmoLab\miniconda3\envs\sleap_tfh\lib\site-packages\tensorflow\python\saved_model\load.py", line 936, in load
    result = load_internal(export_dir, tags, options)["root"]
  File "C:\Users\TalmoLab\miniconda3\envs\sleap_tfh\lib\site-packages\tensorflow\python\saved_model\load.py", line 949, in load_internal
    loader_impl.parse_saved_model_with_debug_info(export_dir))
  File "C:\Users\TalmoLab\miniconda3\envs\sleap_tfh\lib\site-packages\tensorflow\python\saved_model\loader_impl.py", line 57, in parse_saved_model_with_debug_info
    saved_model = parse_saved_model(export_dir)
  File "C:\Users\TalmoLab\miniconda3\envs\sleap_tfh\lib\site-packages\tensorflow\python\saved_model\loader_impl.py", line 115, in parse_saved_model
    raise IOError(
OSError: SavedModel file does not exist at: C:\Users\TalmoLab\AppData\Local\Temp\tfhub_modules\29fb93a7b6cbd61f33bf8c76777682f0a9b06839\{saved_model.pbtxt|saved_model.pb}

tensorflow_hub Version

0.12.0 (latest stable release)

TensorFlow Version

2.8 (latest stable release)

Other libraries

# Name                    Version                   Build  Channel
tensorflow                2.8.4                    pypi_0    pypi
tensorflow-estimator      2.8.0                    pypi_0    pypi
tensorflow-io-gcs-filesystem 0.31.0                   pypi_0    pypi

Python Version

3.x

OS

Windows

@roomrys roomrys changed the title Bug: hub.load not working in example Bug: hub.load not working in provided example Mar 17, 2023
@WGierke
Copy link
Collaborator

WGierke commented Mar 17, 2023

It works for me in a fresh Colab. What's the content of C:\Users\TalmoLab\AppData\Local\Temp\tfhub_modules\29fb93a7b6cbd61f33bf8c76777682f0a9b06839?

Also, you could try removing that directory and re-trying.

@singhniraj08 singhniraj08 self-assigned this Mar 17, 2023
@roomrys
Copy link
Author

roomrys commented Mar 17, 2023

@singhniraj08 Huzzah!

Simply removing the Temp directory solves everything. Not sure what was in the directory to cause the problems, but it might be related to having multiple environments running the same test/accessing the same resources at the same time (and then not removing those resources)?

Unsure, but problem solved, thanks!

@roomrys roomrys closed this as completed Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants