使用 Tensorflow 中的 BERT 模型时出错

Jas*_*son 5 python tensorflow bert-language-model

我尝试按照 Tensorflow 说明使用 BERT 模型:(https://www.tensorflow.org/tutorials/text/classify_text_with_bert

但是,当我运行这些行时:

text_test = ['this is such an amazing movie!']
text_preprocessed = bert_preprocess_model(text_test)
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

InvalidArgumentError: 尝试使用错误的类型访问资源。预期类 tensorflow::lookup::LookupInterface 得到类 tensorflow::lookup::LookupInterface
     [[{{node StatefulPartitionedCall/StatefulPartitionedCall/bert_tokenizer/StatefulPartitionedCall/WordpieceTokenizeWithOffsets/WordpieceTokenizeWithOffsets/WordpieceTokenizeWithOffsets}}]] [Op:__inference_restored_function_body_72474]

这两个类完全相同:“tensorflow::lookup::LookupInterface”。有人可以帮忙吗?谢谢你。

小智 0

我在 Windows 10 中也遇到了同样的错误。然后我在 wsl2 ubuntu 18.04 中尝试了它并且工作正常。在 wsl2 ubuntu 中尝试一下怎么样