strongio / keras-bert

A simple technique to integrate BERT from tf hub to keras
258 stars 108 forks source link

FailedPreconditionError #25

Closed Taucius closed 5 years ago

Taucius commented 5 years ago

Has anyone encountered this error?

Traceback (most recent call last): File "keras-bert.py", line 336, in main() File "keras-bert.py", line 333, in main model.fit([train_input_ids, train_input_masks, train_segment_ids],train_labels,validation_data=([test_input_ids, test_input_masks, test_segment_ids],test_labels,),epochs=1,batch_size=32,) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/training.py", line 643, in fit use_multiprocessing=use_multiprocessing) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/training_arrays.py", line 664, in fit steps_name='steps_per_epoch') File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/training_arrays.py", line 383, in model_iteration batch_outs = f(ins_batch) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/backend.py", line 3353, in call run_metadata=self.run_metadata) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/client/session.py", line 1458, in call run_metadata_ptr) tensorflow.python.framework.errors_impl.FailedPreconditionError: Error while reading resource variable bert_layer_module/bert/encoder/layer_9/attention/self/query/bias from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/bert_layer_module/bert/encoder/layer_9/attention/self/query/bias/N10tensorflow3VarE does not exist. [[{{node bert_layer/bert_layer_module_apply_tokens/bert/encoder/layer_9/attention/self/query/BiasAdd/ReadVariableOp}}]]

The code is basically the same, just some minor changes in the process to overcome other errors.