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

ModuleNotFoundError: No module named 'keras.src.engine' #27

Open
ivanstepanovftw opened this issue Mar 5, 2024 · 7 comments
Open

ModuleNotFoundError: No module named 'keras.src.engine' #27

ivanstepanovftw opened this issue Mar 5, 2024 · 7 comments
Labels

Comments

@ivanstepanovftw
Copy link

ivanstepanovftw commented Mar 5, 2024

Traceback (most recent call last):
  File "/p/i/proj/waternet_tf.py", line 5, in <module>
    import nobuco
  File "/p/i/proj/.venv/lib/python3.12/site-packages/nobuco/__init__.py", line 1, in <module>
    from nobuco.converters.channel_ordering import t_pytorch2keras, t_keras2pytorch
  File "/p/i/proj/.venv/lib/python3.12/site-packages/nobuco/converters/channel_ordering.py", line 6, in <module>
    from nobuco.commons import ChannelOrder, TF_TENSOR_CLASSES
  File "/p/i/proj/.venv/lib/python3.12/site-packages/nobuco/commons.py", line 3, in <module>
    from keras.src.engine.keras_tensor import KerasTensor
ModuleNotFoundError: No module named 'keras.src.engine'

Both tensorflow and keras installed.

Python 3.12.2
nobuco 0.12.0
keras 3.0.5
tensorflow 2.16.0rc0
torch 2.2.0

@AlexanderLutsenko
Copy link
Owner

Hi! Starting with 2.16-rc0, Tensorflow resolves to Keras 3. The new Keras is not fully backward-compatible. Nobuco is tested with 2.15 and will continue to rely on the old Keras 2 until the first stable release of 2.16.

@AlexanderLutsenko
Copy link
Owner

Transitioning to Keras 3 turned out more complicated than was advertised (see keras-team/keras#19314). I'll get back to it as soon as there is more clarity regarding the new Keras' design.

@pedrofrodenas
Copy link

pedrofrodenas commented Mar 22, 2024

Yes, Indeed keras.src.engine.keras_tensor was moved to from keras.src.backend import KerasTensor . I already tried this but another errors arrise. During model conversion because keras.backend.placeholder was also removed in the newer tensorflow 2.16 version.

@AlexanderTekle
Copy link

do we still have to use tensorflow 2.15 to avoid this error?

@AlexanderLutsenko
Copy link
Owner

@AlexanderTekle Shortly put, yes.

@kabyanil
Copy link

kabyanil commented Aug 2, 2024

Using tensorflow 2.15 works for model conversion, from pytorch to keras. But, I am not able to use tfjs_converted to convert the keras model to tfjs. I tried saving the keras model in both .keras and .h5 format, but it does not seem to work.

@johndpope
Copy link

johndpope commented Oct 17, 2024

folks at google should put some effort in to help here. i really want to use tfjs (bypassing onnx)- and yet getting my code over to tensorflow has been a complete ball breaker.

UPDATE - looking into using this which has pytorch models -> tensorflow lite as of tensorflow 2.17
https://github.com/google-ai-edge/ai-edge-torch

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

No branches or pull requests

6 participants