0

I was working fine with keras (Tensorflow as Backend) and training the model without any problems but when I installed cuda and CUDNN (follwoing in this link) to work with gpu, it gives me the following error:


UnknownError Traceback (most recent call last) in 562 #print(gan_model.) 563 # train model --> 564 train(d_model, g_model, gan_model, dataset,n_epochs=200, n_batch=1, checkpoint_epoch=50) 565 #history = model.fit(X, Y, validation_split=0.33, epochs=1, batch_size=10, verbose=0) 566 print('Finished')

in train(d_model, g_model, gan_model, dataset, n_epochs, n_batch, checkpoint_epoch) 499 [X_realA, X_realB], y_real = generate_real_samples(dataset, n_batch, n_patch) 500 # generate a batch of fake samples --> 501 X_fakeB, y_fake = generate_fake_samples(g_model, X_realA, n_patch) 502 # update discriminator for real samples 503 d_loss1, d_acc1 = d_model.train_on_batch([X_realA, X_realB], y_real)

in generate_fake_samples(g_model, samples, patch_shape) 176 def generate_fake_samples(g_model, samples, patch_shape): 177 # generate fake instance --> 178 X = g_model.predict(samples) 179 # create 'fake' class labels (0) 180 y = zeros((len(X), patch_shape, patch_shape, 1))

~/anaconda3/lib/python3.7/site-packages/keras/engine/training.py in predict(self, x, batch_size, verbose, steps, callbacks, max_queue_size, workers, use_multiprocessing) 1460 verbose=verbose, 1461 steps=steps, -> 1462 callbacks=callbacks) 1463 1464 def train_on_batch(self, x, y,

~/anaconda3/lib/python3.7/site-packages/keras/engine/training_arrays.py in predict_loop(model, f, ins, batch_size, verbose, steps, callbacks) 322 batch_logs = {'batch': batch_index, 'size': len(batch_ids)} 323 callbacks._call_batch_hook('predict', 'begin', batch_index, batch_logs) --> 324 batch_outs = f(ins_batch) 325 batch_outs = to_list(batch_outs) 326 if batch_index == 0:

~/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/backend.py in call(self, inputs) 3725 value = math_ops.cast(value, tensor.dtype) 3726 converted_inputs.append(value) -> 3727 outputs = self._graph_fn(*converted_inputs) 3728 3729 # EagerTensor.numpy() will often make a copy to ensure memory safety.

~/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py in call(self, *args, **kwargs) 1549 TypeError: For invalid positional/keyword argument combinations. 1550 """ -> 1551 return self._call_impl(args, kwargs) 1552 1553 def _call_impl(self, args, kwargs, cancellation_manager=None):

~/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py in _call_impl(self, args, kwargs, cancellation_manager) 1589 raise TypeError("Keyword arguments {} unknown. Expected {}.".format( 1590 list(kwargs.keys()), list(self._arg_keywords))) -> 1591 return self._call_flat(args, self.captured_inputs, cancellation_manager) 1592 1593 def _filtered_call(self, args, kwargs):

~/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py in _call_flat(self, args, captured_inputs, cancellation_manager) 1690 # No tape is watching; skip to running the function. 1691 return self._build_call_outputs(self._inference_function.call( -> 1692 ctx, args, cancellation_manager=cancellation_manager)) 1693 forward_backward = self._select_forward_and_backward_functions( 1694 args,

~/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py in call(self, ctx, args, cancellation_manager) 543 inputs=args, 544 attrs=("executor_type", executor_type, "config_proto", config), --> 545 ctx=ctx) 546 else: 547 outputs = execute.execute_with_cancellation(

~/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name) 65 else: 66 message = e.message ---> 67 six.raise_from(core._status_to_exception(e.code, message), None) 68 except TypeError as e: 69 keras_symbolic_tensors = [

~/anaconda3/lib/python3.7/site-packages/six.py in raise_from(value, from_value)

UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above. [[node conv2d_35/convolution (defined at /home/hadeel/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3009) ]] [Op:__inference_keras_scratch_graph_13707] Function call stack: keras_scratch_graph


(1) Can you tell me how can I fix it,please?

(2) Also, How can I work on tensorflow with cpu only even if I have cuda and cudnn installed? becuase as I understood, if my machine have cuda and cudnn, the tensorflow will use gpu by defalut.

More details: Ubuntu: 18.04 Tensorflow: 2.1.0 Tensorflow-gpu: 2.1.0 GPU: GeForce RTX 2080 Cuda: 10.1 Cudnn: 7.6 TensorRT: 6.0

Thank you Hadeel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.