Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

load_trained_model_from_checkpoint(config_path,checkpoint_file=checkpoint_path) #225

Open
dshwei opened this issue Aug 23, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@dshwei
Copy link

dshwei commented Aug 23, 2023

pandas==1.1.5
Keras==2.3.1
keras_bert==0.83.0
numpy==1.16.4
scikit_learn==0.24.0
scipy==1.4.1
tensorboard=2.3.0
tensorflow-estimator==2.3.0
tensorflow==2.2

config_path = './chinese_L-12_H-768_A-12/bert_config.json'
checkpoint_path = './chinese_L-12_H-768_A-12/bert_model.ckpt'
dict_path = './chinese_L-12_H-768_A-12/vocab.txt'
model = load_trained_model_from_checkpoint(config_path,checkpoint_file=checkpoint_path)

: 8.9)
Traceback (most recent call last):
File "model_train.py", line 156, in
model = create_cls_model(len(labels))
File "model_train.py", line 89, in create_cls_model
bert_model = load_trained_model_from_checkpoint(config_path, checkpoint_path, seq_len=None)
File "/home/miniconda3/envs/tf2.2/lib/python3.8/site-packages/keras_bert/loader.py", line 163, in load_trained_model_from_checkpoint
model, config = build_model_from_config(
File "/home/miniconda3/envs/tf2.2/lib/python3.8/site-packages/keras_bert/loader.py", line 46, in build_model_from_config
model = get_model(
File "/home/miniconda3/envs/tf2.2/lib/python3.8/site-packages/keras_bert/bert.py", line 79, in get_model
embed_layer, embed_weights = get_embedding(
File "/home/miniconda3/envs/tf2.2/lib/python3.8/site-packages/keras_bert/layers/embedding.py", line 50, in get_embedding
embed_layer = PositionEmbedding(
File "/home/miniconda3/envs/tf2.2/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 953, in call
inputs, outputs = self.set_connectivity_metadata(
File "/home/miniconda3/envs/tf2.2/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 2313, in set_connectivity_metadata
self._add_inbound_node(
File "/home/miniconda3/envs/tf2.2/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 2329, in _add_inbound_node
inbound_layers = nest.map_structure(lambda t: t._keras_history.layer,
File "/home/miniconda3/envs/tf2.2/lib/python3.8/site-packages/tensorflow/python/util/nest.py", line 617, in map_structure
structure[0], [func(*x) for x in entries],
File "/home/miniconda3/envs/tf2.2/lib/python3.8/site-packages/tensorflow/python/util/nest.py", line 617, in
structure[0], [func(*x) for x in entries],
File "/home/miniconda3/envs/tf2.2/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 2329, in
inbound_layers = nest.map_structure(lambda t: t._keras_history.layer,
AttributeError: 'tuple' object has no attribute 'layer'

@dshwei dshwei added the bug Something isn't working label Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants