我正在尝试使用 TensorFlow Hub 中的 Bert 并构建一个标记器,这就是我正在做的事情:
>>> import tensorflow_hub as hub
>>> from bert.tokenization import FullTokenizer
>>> BERT_URL = 'https://tfhub.dev/tensorflow/bert_zh_L-12_H-768_A-12/1'
>>> bert_layer = hub.KerasLayer(BERT_URL, trainable=False)
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py:1781: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py:1781: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
但是现在当我检查已解析对象中的词汇文件时,我得到一个空张量
>>> bert_layer.resolved_object.vocab_file.asset_path.shape
TensorShape([])
获取此词汇文件的正确方法是什么?