Python 通用句子编码器类型错误修剪(文本)预期张量

Python 通用句子编码器类型错误修剪(文本)预期张量,python,tensorflow,tensorflow-hub,Python,Tensorflow,Tensorflow Hub,我已经将universal Session encoder 2下载到一台没有互联网接入的计算机上,并解压缩到一个目标文件夹:“data” import tensorflow as tf import tensorflow_hub as hub USE_embedder = hub.load(r'data/') 如果我像往常一样运行USE_embedder(['test']),我会得到一个错误:TypeError:“Autotrackable”对象是不可调用的。但是按照tensorflow文档

我已经将universal Session encoder 2下载到一台没有互联网接入的计算机上,并解压缩到一个目标文件夹:“data”

import tensorflow as tf
import tensorflow_hub as hub

USE_embedder = hub.load(r'data/')
如果我像往常一样运行
USE_embedder(['test'])
,我会得到一个错误:
TypeError:“Autotrackable”对象是不可调用的。
但是按照tensorflow文档,我认为我可以运行:

USE_embedder.signatures['default'](['test'])
但是我得到了类型错误:

TypeError: pruned(text: expected argument #0(zero-based to be a Tensor; got list(['test'])
当我可以从联网的计算机上运行它时,从加载而不是提取的下载,我可以很好地运行类似的东西。如何使模型能够嵌入文档中通常显示的文本(例如,
USE_embedder(['text'])
返回向量)


使用:Python 3.6.7、Tensorflow 2.4.1、Tensorflow_hub 0.11.0

将列表转换为张量时,应该可以使用:

USE_embedder.signatures['default'](tf.constant(['test']))
(使用TF 2.4.1、tensorflow_轮毂0.11.0进行测试)