利用tensorflow_hub调用bert(tensorflow 1.x)
我试图在 tensorflow 2.x 下调用 bert 。一直没有找到正确的代码(有些博客标明可用tensorflow 2.0 + tensorflow_hub 调用bert,但我运行时却发现各种错误)。最终还是选择了 tensorflow 1.x 版本。
先安装需要的包:
pip install "tensorflow>=1.15,<2.0"
pip install --upgrade tensorflow-hub
pip install bert-tensorflow==1.0.1
原创
2020-10-01 22:13:56 ·
2221 阅读 ·
17 评论