问题:在使用keras-bert 导入预训练的模型时, 报错Layer model_1 expects 3 inputs, but it received 2 input tensors
导入代码: bert_model = load_trained_model_from_checkpoint(config_path, checkpoint_path, training=True,output_layer_num=7,trainable=True,seq_len=Config.max_seq_len) # 加载预训练模型 具体报错: Layer model_1 expects 3 inputs, but it received 2 input tensors. Input received: [<tf.Tensor 'input_1:0' shape=(?, 100) dtype=float32>, <tf.Tensor 'input_2:0' shape=(?, 100) dtype=float32>] 解决方式:去掉参数 training=True 具体:bert_model = load_trained_model_from_checkpoint(config_path, checkpoint_path, output_layer_num=7, trainable=True, seq_len=Config.max_seq_len)
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:keras-bert,加载预训练模型报错 Layer model_1 expects 3 inputs, but it received 2 input tensors - Python技术站