(input_file,out_file)
NER模型预测，用loss和f1保存的18个模型进行预测，保存结果，后续会对结果投票选择实体
    :param input_file:
    :param out_file:
    :return:
NER模型预测，用loss和f1保存的18个模型进行预测，保存结果，后续会对结果投票选择实体
    :param input_file:
    :param out_file:
    :return:
NER模型预测，用loss和f1保存的18个模型进行预测，保存结果，后续会对结果投票选择实体 : param input_file : : param out_file : : return :
def predict(input_file,out_file):
    '''
    NER模型预测，用loss和f1保存的18个模型进行预测，保存结果，后续会对结果投票选择实体
    :param input_file:
    :param out_file:
    :return:
    '''
    print('test predict')
    all_test=[]
    for i in range(9):
        print(i)
        model = bert_model()
        filepath_loss = "model/NER_bert_crf_loss.h5" + str(i)
        test = get_input(input_file)
        model.load_weights(filepath_loss)
        y_pred_test = model.predict(test[:-1], batch_size=8, verbose=2)
        all_test.append(y_pred_test)
        model = bert_model()
        filepath_f1 = "model/NER_bert_crf_f1.h5" + str(i)
        test = get_input(input_file)
        model.load_weights(filepath_f1)
        y_pred_test = model.predict(test[:-1], batch_size=8, verbose=2)
        all_test.append(y_pred_test)

    np.save(out_file, all_test)
def predict ( input_file , out_file ) : print ( 'test predict' ) all_test = [ ] for i in range ( 9 ) : print ( i ) model = bert_model ( ) filepath_loss = "model/NER_bert_crf_loss.h5" + str ( i ) test = get_input ( input_file ) model . load_weights ( filepath_loss ) y_pred_test = model . predict ( test [ : - 1 ] , batch_size = 8 , verbose = 2 ) all_test . append ( y_pred_test ) model = bert_model ( ) filepath_f1 = "model/NER_bert_crf_f1.h5" + str ( i ) test = get_input ( input_file ) model . load_weights ( filepath_f1 ) y_pred_test = model . predict ( test [ : - 1 ] , batch_size = 8 , verbose = 2 ) all_test . append ( y_pred_test ) np . save ( out_file , all_test )