You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
config_path = 'WoBERT/bert_config.json'
checkpoint_path = 'WoBERT/bert_model.ckpt'
dict_path = 'WoBERT/vocab.txt'
bert = bert4keras.models.build_transformer_model(
config_path=config_path,
checkpoint_path=checkpoint_path,
with_pool=True,
hierarchical_position=True,
return_keras_model=False,
)
当想加载WoBERT+模型,却会报错Key bert/pooler/dense/kernel not found in checkpoint,能帮帮我吗
Traceback (most recent call last):
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\tensorflow\python\training\py_checkpoint_reader.py", line 70, in get_tensor
self, compat.as_bytes(tensor_str))
RuntimeError: Key bert/pooler/dense/kernel not found in checkpoint
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\IPython\core\interactiveshell.py", line 3343, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 6, in
return_keras_model=False,
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\bert4keras\models.py", line 2338, in build_transformer_model
transformer.load_weights_from_checkpoint(checkpoint_path)
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\bert4keras\models.py", line 297, in load_weights_from_checkpoint
raise e
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\bert4keras\models.py", line 291, in load_weights_from_checkpoint
values.append(self.load_variable(checkpoint, v))
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\bert4keras\models.py", line 691, in load_variable
variable = super(BERT, self).load_variable(checkpoint, name)
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\bert4keras\models.py", line 262, in load_variable
return tf.train.load_variable(checkpoint, name)
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\tensorflow\python\training\checkpoint_utils.py", line 85, in load_variable
return reader.get_tensor(name)
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\tensorflow\python\training\py_checkpoint_reader.py", line 74, in get_tensor
error_translator(e)
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\tensorflow\python\training\py_checkpoint_reader.py", line 35, in error_translator
raise errors_impl.NotFoundError(None, None, error_message)
tensorflow.python.framework.errors_impl.NotFoundError: Key bert/pooler/dense/kernel not found in checkpoint
不过当转换为pytorch版时,却能够正常加载使用。
The text was updated successfully, but these errors were encountered:
config_path = 'WoBERT/bert_config.json'
checkpoint_path = 'WoBERT/bert_model.ckpt'
dict_path = 'WoBERT/vocab.txt'
bert = bert4keras.models.build_transformer_model(
config_path=config_path,
checkpoint_path=checkpoint_path,
with_pool=True,
hierarchical_position=True,
return_keras_model=False,
)
当想加载WoBERT+模型,却会报错Key bert/pooler/dense/kernel not found in checkpoint,能帮帮我吗
Traceback (most recent call last):
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\tensorflow\python\training\py_checkpoint_reader.py", line 70, in get_tensor
self, compat.as_bytes(tensor_str))
RuntimeError: Key bert/pooler/dense/kernel not found in checkpoint
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\IPython\core\interactiveshell.py", line 3343, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 6, in
return_keras_model=False,
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\bert4keras\models.py", line 2338, in build_transformer_model
transformer.load_weights_from_checkpoint(checkpoint_path)
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\bert4keras\models.py", line 297, in load_weights_from_checkpoint
raise e
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\bert4keras\models.py", line 291, in load_weights_from_checkpoint
values.append(self.load_variable(checkpoint, v))
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\bert4keras\models.py", line 691, in load_variable
variable = super(BERT, self).load_variable(checkpoint, name)
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\bert4keras\models.py", line 262, in load_variable
return tf.train.load_variable(checkpoint, name)
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\tensorflow\python\training\checkpoint_utils.py", line 85, in load_variable
return reader.get_tensor(name)
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\tensorflow\python\training\py_checkpoint_reader.py", line 74, in get_tensor
error_translator(e)
File "C:\Users\14301\miniconda3\envs\gluon\lib\site-packages\tensorflow\python\training\py_checkpoint_reader.py", line 35, in error_translator
raise errors_impl.NotFoundError(None, None, error_message)
tensorflow.python.framework.errors_impl.NotFoundError: Key bert/pooler/dense/kernel not found in checkpoint
不过当转换为pytorch版时,却能够正常加载使用。
The text was updated successfully, but these errors were encountered: