简体   繁体   中英

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?

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\')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM