Hello there, first post here, so please let me know if there is a specific format I should post in or if there is more information you need to be able to comment.
I’m currently trying to train a CNN with help from my GPU. For that I followed the installation guide from the tensorflow documentation: Install TensorFlow with pip , except installing MiniConda because I’m using Anaconda.
This worked fine, my GPU is detected by tensorflow, but whenever I try to import something from keras, I get the error mentioned in the title of the post. So for example when I’m importing EarlyStopping like this from tensorflow.keras.callbacks import EarlyStopping it throws the error: ImportError: cannot import name ‘type_spec_registry’ from ‘tensorflow.python.framework’ (C:\Users\USER\anaconda3\envs\tf\lib\site-packages\tensorflow\python\framework_init_.py)
I’m not sure why this happens. I’m using tensorflow version 2.10.1, installed CUDA 11.2, cuDNN 8.1 and python 3.9.16.
If anyone knows something about this, please share any info!
I couldn’t make it work with a lower version and then tried upgrading to tensorflow 2.11 and the error didn’t occur anymore. But I wanted to use a lower tensorflow version in the first place, because of the GPU support. Isn’t there any way to make a lower tensorflow version work with keras?
Sorry for the late response. Usually the fix in the older versions will be done if that is a security bug.
Generally, there are more bug fixes and enhancements in the latest versions.
In your case you can still access GPU on windows through WSL2. For more details please refer to Installer TensorFlow avec pip.
Hello, please help me. How can I fix this error "
AttributeError: module ‘keras.api._v2.keras.layers’ has no attribute ‘Transformer’" ? .
In my code when I use layers.Transformer like this transformer = layers.Transformer(num_layers=4, d_model=32, num_heads=4, activation=‘relu’, dropout=0.2)(inputs) give me this error
"import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers, models, losses, regularizers, optimizers, callbacks
import tensorflow_addons as tfa
transformer_encoder = tfa.layers.TransformerEncoder(num_layers=2, d_model=32, num_heads=4,
dff=64, dropout=0.1, activation=‘relu’)(cnn)
"
Hello, please help me, this is a part of my code that relevent to error.
when run the code I encounter this error. I import Transformer layer with this" tensorflow_addons as tfa" at the beginning of the code.
AttributeError: module ‘tensorflow_addons.layers’ has no attribute ‘TransformerEncoder’"
Also, The version of tensorflow is “2.6.0” and the version of python is “3.9.12”
and “tensorflow_addons==0.16.1” that all is compatible together.