strongio / keras-bert

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

failed prediction error. #28

Closed urvishp80 closed 4 years ago

urvishp80 commented 5 years ago

I am running the script on my machine with the following configuration TF = 1.14 OS = Windows 10 Python = 3.7

Here is the full error

  File "keras-bert.py", line 354, in <module>
    main()
  File "keras-bert.py", line 339, in main
    batch_size=32,
  File "C:\Users\Urvish\Envs\tf_1_14\lib\site-packages\tensorflow\python\keras\engine\training.py", line 780, in fit
    steps_name='steps_per_epoch')
  File "C:\Users\Urvish\Envs\tf_1_14\lib\site-packages\tensorflow\python\keras\engine\training_arrays.py", line 363, in model_iteration
    batch_outs = f(ins_batch)
  File "C:\Users\Urvish\Envs\tf_1_14\lib\site-packages\tensorflow\python\keras\backend.py", line 3292, in __call__
    run_metadata=self.run_metadata)
  File "C:\Users\Urvish\Envs\tf_1_14\lib\site-packages\tensorflow\python\client\session.py", line 1458, in __call__
    run_metadata_ptr)
tensorflow.python.framework.errors_impl.FailedPreconditionError: 2 root error(s) found.
  (0) Failed precondition: Error while reading resource variable bert_layer_module/bert/encoder/layer_9/output/LayerNorm/gamma from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/bert_layer_module/bert/encoder/layer_9/output/LayerNorm/gamma/class tensorflow::Var does not exist.
         [[{{node bert_layer/bert_layer_module_apply_tokens/bert/encoder/layer_9/output/LayerNorm/batchnorm/mul/ReadVariableOp}}]]
         [[loss/mul/_489]]
  (1) Failed precondition: Error while reading resource variable bert_layer_module/bert/encoder/layer_9/output/LayerNorm/gamma from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/bert_layer_module/bert/encoder/layer_9/output/LayerNorm/gamma/class tensorflow::Var does not exist.
         [[{{node bert_layer/bert_layer_module_apply_tokens/bert/encoder/layer_9/output/LayerNorm/batchnorm/mul/ReadVariableOp}}]]
0 successful operations.
0 derived errors ignored.
jacobzweig commented 4 years ago

Please try using the updated requirements (tf 1.12)