dmlc / keras

Deep Learning library for Python. Convnets, recurrent neural networks, and more. Runs on MXNet, Theano or TensorFlow.
http://keras.io/
Other
125 stars 34 forks source link

how to predict on GPU with keras1.2 and mxnet #92

Closed qgking closed 6 years ago

qgking commented 6 years ago

I have trained model using multi-gpu. while in the prediction phase.I found that this code did not working on GPU model_cnn.predict(train_set, batch_size=CFG['batch_size']) so,how can i run predict on GPU

qgking commented 6 years ago

i found the model.py source code of keras 1.2.2 from dmlc, and changed the code, compile, install loss = deserialize(training_config['loss']) metrics = deserialize(training_config['metrics']) sample_weight_mode = training_config['sample_weight_mode'] loss_weights = training_config['loss_weights'] gpu_list = ["gpu(0)","gpu(1)","gpu(2)","gpu(3)"]

compile model

model.compile(optimizer=optimizer,
              loss=loss,
              metrics=metrics,
              loss_weights=loss_weights,
              sample_weight_mode=sample_weight_mode,context=gpu_list)

god bless me !!!

qgking commented 6 years ago

emmmm,,,,it works!! ahaha