Skip to content

Bug: ValueError when loading model previously cached but now missing #896

Closed
@sammlapp

Description

@sammlapp

What happened?

Loading a tensorflow hub model that I previously loaded results in an error. As described in #575, it seems that TF Hub looks for the model in an existing temp directory. The model is gone, but the folder still exists. If I manually delete the folder, and re-run tensorflow_hub.load(url) it works properly. Therefore, it seems there is a bug in the way that TF Hub looks for cached models.

The correct behavior would be to re-download the model if does not exist locally, or to use the cached version if it exists locally.

It seems as if this PR should have resolved the issue
#602

A related issue: https://stackoverflow.com/questions/63078695/savedmodel-file-does-not-exist-when-using-tensorflow-hub

Relevant code

import tensorflow_hub
url = 'https://tfhub.dev/google/yamnet/1'
tensorflow_hub.load(url)

Relevant log output

ValueError: Trying to load a model of incompatible/unknown type. '/var/folders/d8/265wdp1n0bn_r85dh3pp95fh0000gq/T/tfhub_modules/9616fd04ec2360621642ef9455b84f4b668e219e' contains neither 'saved_model.pb' nor 'saved_model.pbtxt'.

tensorflow_hub Version

other (please specify)

TensorFlow Version

other (please specify)

Other libraries

Tensorflow: '2.13.0'
Tensorflow Hub: '0.14.0'

Python Version

3.x

OS

macOS

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions