google-research / albert

ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
Apache License 2.0
3.24k stars 569 forks source link

tensorflow.python.framework.errors_impl.FailedPreconditionError #125

Open buptgxt opened 4 years ago

buptgxt commented 4 years ago

my code: `input_word_ids = tf.keras.layers.Input( (MAX_SEQUENCE_LENGTH,), dtype=tf.int32, name='input_word_ids') input_masks = tf.keras.layers.Input( (MAX_SEQUENCE_LENGTH,), dtype=tf.int32, name='input_masks') input_segments = tf.keras.layers.Input( (MAX_SEQUENCE_LENGTH,), dtype=tf.int32, name='input_segments') bert_inputs = dict(input_ids=input_word_ids, input_mask=input_masks, segment_ids=input_segments)

tags = set() tags.add("train") bert_layer = hub.Module(ALBERT_PATH, tags = tags, trainable=True) output = bert_layer(inputs=bert_inputs,signature="tokens",as_dict=True)["sequence_output"] x = tf.keras.layers.GlobalAveragePooling1D()(output_layer)`

FailedPreconditionError: Error while reading resource variable module_5/bert/encoder/transformer/group_0/inner_group_0/ffn_1/intermediate/output/dense/bias from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/module_5/bert/encoder/transformer/group_0/inner_group_0/ffn_1/intermediate/output/dense/bias/N10tensorflow3VarE does not exist. [[{{node module_5_apply_tokens/bert/encoder/transformer/group_0_23/layer_23/inner_group_0/ffn_1/intermediate/output/dense/add/ReadVariableOp}}]]