Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'VersionAwareLayers' from 'keras.layers' #11

Open
nasir3843 opened this issue Jun 19, 2022 · 6 comments

Comments

@nasir3843
Copy link

nasir3843 commented Jun 19, 2022

Thank you for the great work.

I am experiencing the following error over and over, even though I created a brand new tensorflow environment and installed all the necessary libraries in it. Could you please have a look on it and guide me how do I solve this problem? Thank you.

ImportError: Unable to import 'VersionAwareLayers' from 'keras.layers' (/home/ubuntu/anaconda3/envs/cm_3d/lib/python3.7/site-packages/keras/layers/init.py)

@djrumala
Copy link

djrumala commented Jan 4, 2023

I experienced the same thing. Have you found any solution? Is it due to tensorflow or keras version?

@nasir3843
Copy link
Author

nasir3843 commented Jan 5, 2023

Sorry, I don't exactly remember what worked for me that time but I managed to solve this problem. If you prefer, you can create conda enviroment same as mine using .yaml file of my working environment. This will install required versions of tensorflow and keras libraries for you.

.yaml file : https://drive.google.com/file/d/1TGsXzsncMlZsaGxg3dwKK_JG5tQLkG0P/view
conda commad : conda env create -f [path to .yaml file]

@djrumala
Copy link

djrumala commented Jan 5, 2023

Right, it seems due to the tensorflow and Keras version. I tried to search for this issue on ChatGPT and here is what I got:

It looks like you are trying to import a module or class called VersionAwareLayers from the keras.layers module, but you are unable to do so.

Here are a few things you can try:

Make sure that you have installed the latest version of Keras, as the VersionAwareLayers class may have been added in a recent version.
Check the spelling of the class name to make sure it is correct.
Make sure that you are using the correct import statement. The correct import statement for the VersionAwareLayers class would be from keras.layers import VersionAwareLayers.
If you are using a version of Keras that is older than 2.4, it is possible that the VersionAwareLayers class does not exist in that version. In this case, you will need to upgrade to a newer version of Keras in order to use this class.
I hope this helps! Let me know if you have any other questions or if there is anything else I can do to help.

@ZFTurbo
Copy link
Owner

ZFTurbo commented Jan 5, 2023

If you find the working versions of tensorflow and keras I will add it in requirements. I think there were some critical changes in latest tensorflow.

@djrumala
Copy link

djrumala commented Feb 4, 2023

@ZFTurbo For me, it finally worked with Tensorflow 2.9.0 and Keras 2.9.0

@Maidul02
Copy link

@ZFTurbo Tensorflow 2.9.0 and Keras 2.9.0 worked for me as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants