无法从 TensorFlow 加载模型

huangapple go评论63阅读模式
英文:

Unable to load model from tensor flow

问题

我正在尝试从 TensorFlow 加载模型,但它不起作用。

以下是代码部分:

import tensorflow_hub as hub

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

embeddings = embed([
    "The quick brown fox jumps over the lazy dog.",
    "I am a sentence for which I would like to get its embedding"])

print(embeddings)

我没有收到错误消息,代码只是停在那里不运行。有任何帮助吗?

英文:

I am trying to load a model from tensor flow but its not working.

here is the code::

import tensorflow_hub as hub


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

embeddings = embed([
    "The quick brown fox jumps over the lazy dog.",
    "I am a sentence for which I would like to get its embedding"])

print(embeddings)

I dont get an error, the code just gets stuck and does not run.
any help

答案1

得分: 0

你的代码没有问题。
它在我的系统上运行正常。
模型的大小约为1GB,因此加载它需要一些时间(对我来说需要20-30秒)。
检查你的网络连接或尝试在其他系统上运行代码,比如Google Colab。

英文:

There is no problem in your code.<Br>
It work fine on my system.<br>

The size of the model is about 1GB, so it will take some time to load it (for me it takes 20-30 sec). Check your internet connectivity or you can try to run the code on other system like Google colab.

huangapple
  • 本文由 发表于 2023年6月19日 23:40:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76508157.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定