multi_seq=True) print("construct data...finish") print('test_question_seq.shape: ' + str(dm.data['test_question'].shape)) print('test_option.shape: ' + str(dm.data['test_option'].shape)) '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' ''' loading model ''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' model = load_model(continue_file) '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' ''' print model ''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' model.summary() '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' ''' decoder ''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' data_in = dm.wrape_encoder(dm.data['test_question'], voc) print(data_in.shape) test_model = dm.construct_seq2seq_test(model, 1024) data_out = [] #for i in range(len(data_in)): for i in range(6): print('\rdecoding... sequence: ' + str(i), end='') data_out.append( dm.decode_seq(data_in[i].reshape((1, 14, 300)), test_model, voc)) data_out = np.array(data_out) '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' ''' writing output ''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' ''' ''' output = dm.output(data_out)
''' ''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' ''' print model ''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' model.summary() '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' ''' fit model ''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' '''''' encoder_data = np.concatenate( (dm.data['train1'][:-1], dm.data['train2'][:-1], dm.data['train3'][:-1], dm.data['train4'][:-1], dm.data['train5'][:-1])) decoder_data = np.concatenate( (dm.data['train1'][1:], dm.data['train2'][1:], dm.data['train3'][1:], dm.data['train4'][1:], dm.data['train5'][1:])) encoder_input_data = dm.wrape_encoder(encoder_data, voc) decoder_input_data = dm.wrape_decoder(decoder_data, voc, decode_in=True) decoder_target_data = dm.wrape_decoder(decoder_data, voc, decode_in=False) print('encoder_input_data.shape: ', encoder_input_data.shape) print('decoder_input_data.shape: ', decoder_input_data.shape) print('decoder_target_data.shape: ', decoder_target_data.shape) model.fit([encoder_input_data, decoder_input_data], decoder_target_data, batch_size=n_batch, epochs=n_epoch, validation_split=0.1, shuffle=True, callbacks=callbacks_list, verbose=1) ''' '''