Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras Model With CuDNNLSTM Layers Doesn't Work on Production Server

I have used an AWS p3 instance to train the following model using GPU acceleration:

x = CuDNNLSTM(128, return_sequences=True)(inputs)
x = Dropout(0.2)(x)
x = CuDNNLSTM(128, return_sequences=False)(x)
x = Dropout(0.2)(x)
predictions = Dense(1, activation='tanh')(x)
model = Model(inputs=inputs, outputs=predictions)

After training I saved the model with Keras' save_model function and moved it to a separate production server that doesn't have a GPU.

When I attempt to predict using the model on the production server it fails with the following error:

No OpKernel was registered to support Op 'CudnnRNN' with these attrs. Registered devices: [CPU], Registered kernels:

I'm guessing this is because the production server doesn't have GPU support, but I was hoping this wouldn't be a problem. Is there any way I can use this model on a production server without a GPU?

like image 844
amba88 Avatar asked Jan 29 '23 22:01

amba88


1 Answers

No, you can't, CuDNN requires the use of a CUDA GPU. You have to replace your CuDNNLSTM layers with standard LSTM ones.

like image 100
Dr. Snoopy Avatar answered Jan 31 '23 19:01

Dr. Snoopy