0

I am working on a Kaggle notebook where I am trying to import TensorFlow/Keras to build a simple neural network for tabular data.

However, even with Accelerator = None (CPU only), TensorFlow fails during import with multiple CUDA-related warnings and then crashes with a protobuf error.

Here is the minimal reproducible code:

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Input, Dense

model = Sequential([
    Input(shape=(7,)),
    Dense(7, activation='relu'),
    Dense(7, activation='relu'),
    Dense(1, activation='linear')
])

Unable to register cuFFT factory

Unable to register cuDNN factory

Unable to register cuBLAS factory

failed call to cuInit: UNKNOWN ERROR (303)

AttributeError: 'MessageFactory' object has no attribute 'GetPrototype'

enter image description here here is the image of error

1 Answer 1

0

The AttributeError is an incompatibility issue between TensorFlow and a too-new protobuf version. You can fix this by downgrading the protobuf to older versions like 3.20.3 or others and restarting the session, and then use an environment variable to force CPU usage and silence the warnings.

# Run this cell and restart the kernal
!pip install protobuf==3.20.3

# Add these lines before importing TensorFlow
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1' 

import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Input, Dense

# rest of the code...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.