TF Hub上ALBERT预训练模型的问题

时间:2019-10-28 04:06:46

标签: python tensorflow tf-hub

我试图在TF Hub上测试ALBERT模型。尝试从TF Hub加载ALBERT时出现以下错误:

python
Python 3.6.8 (default, May 16 2019, 05:58:38)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36.0.1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow_hub as hub
>>> albert_module = hub.Module(
...     "https://tfhub.dev/google/albert_base/1",
...     trainable=True)
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "/home/opc/vuh/tools/pyvenv3-gpu-tf-hub/lib64/python3.6/site-packages/tensorflow_hub/module.py", line 170, in __init__
    tags=self._tags)
  File "/home/opc/vuh/tools/pyvenv3-gpu-tf-hub/lib64/python3.6/site-packages/tensorflow_hub/native_module.py", line 340, in _create_impl
    name=name)
  File "/home/opc/vuh/tools/pyvenv3-gpu-tf-hub/lib64/python3.6/site-packages/tensorflow_hub/native_module.py", line 382, in __init__
    op.name for op in self._meta_graph.meta_info_def.stripped_op_list.op})
  File "/home/opc/vuh/tools/pyvenv3-gpu-tf-hub/lib64/python3.6/site-packages/tensorflow_hub/native_module.py", line 822, in register_ops_if_needed
    % missing_ops.difference(set(cpp_registry_ops.keys())))
tensorflow.python.framework.errors_impl.NotFoundError: Graph ops missing from the python registry ({'BatchMatMulV2'}) are also absent from the c++ registry.

有人知道为什么吗?提前谢谢你吗?

仅供参考,在我的python3 venv中,我正在使用:

tensorflow数据集1.1.0 张量估计器1.13.0 张量流gpu 1.13.1 张量流中心0.6.0 张量流元数据0.14.0 张量流概率0.7.0 tf句子0.1.83 句子0.1.82

1 个答案:

答案 0 :(得分:1)

您似乎回答了自己的问题,但为了让其他人更清楚这一点:

您需要使用 tensorflow >= 1.14.0。旧版本的 TF 中不存在必要的操作 (BatchMatMulV2)。