Mustard Tiger
Mustard Tiger

Reputation: 3671

Load TensorFlow embedding model

I am following the reference from the following page:

https://tfhub.dev/google/universal-sentence-encoder/4

In the code the model is loaded from the internet with the following code:

import tensorflow as tf

embed = hub.load("https://tfhub.dev/google/universal-sentence-encoder/4")

I would like to be able to load a model I have saved in my local directory

For example:

embed = hub.Module('data\models\universal-sentence-encoder_4.tar.gz')

This code returns the following error

RuntimeError: Missing implementation that supports: loader

How can this be done?

Upvotes: 3

Views: 913

Answers (1)

Mustard Tiger
Mustard Tiger

Reputation: 3671

The Issue was that the file was not unzipped.

After unzipping, the directory path was pointed to the unzip content location, with no file name specified.

Also the Module method was changed to load

the code below works, assuming the unzipped embedding model .pb file and accompanying folders are located in the specified directory.

embed = hub.load('data\models\')

Upvotes: 3

Related Questions