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 'dtensor_api' from 'keras.dtensor' #507

Open
ultranoise opened this issue Oct 26, 2023 · 5 comments
Open

Comments

@ultranoise
Copy link

Hi,
I am training a new model at the Colab linked from the VST (https://colab.research.google.com/github/magenta/ddsp/blob/main/ddsp/colab/demos/Train_VST.ipynb). I am running it connected with a T4.

During DDSP installation I get the error below. Is there any incompatibility between the version of tensorflow and keras? how can I solve it?


Installing DDSP...
This should take about 2 minutes...


ImportError Traceback (most recent call last)

/usr/local/lib/python3.10/dist-packages/ipyfilechooser/filechooser.py in _on_select_click(self, _b)
315 if self._callback is not None:
316 try:
--> 317 self._callback(self)
318 except TypeError:
319 # Support previous behaviour of not passing self

12 frames

/usr/local/lib/python3.10/dist-packages/keras/engine/base_layer_utils.py in
22
23 from keras import backend
---> 24 from keras.dtensor import dtensor_api as dtensor
25 from keras.utils import control_flow_util
26 from keras.utils import tf_inspect

ImportError: cannot import name 'dtensor_api' from 'keras.dtensor' (/usr/local/lib/python3.10/dist-packages/keras/dtensor/init.py)

@robinmeier
Copy link

I have the same problem..
here's the output i get:

Installing DDSP...
This should take about 2 minutes...

ImportError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/ipyfilechooser/filechooser.py in _on_select_click(self, _b)
315 if self._callback is not None:
316 try:
--> 317 self._callback(self)
318 except TypeError:
319 # Support previous behaviour of not passing self

12 frames
/usr/local/lib/python3.10/dist-packages/keras/engine/base_layer_utils.py in
22
23 from keras import backend
---> 24 from keras.dtensor import dtensor_api as dtensor
25 from keras.utils import control_flow_util
26 from keras.utils import tf_inspect

ImportError: cannot import name 'dtensor_api' from 'keras.dtensor' (/usr/local/lib/python3.10/dist-packages/keras/dtensor/init.py)

@caiotikaraishi
Copy link

Me too. I have the same problem. I tested it on both Windows and iOS, but the problem remains the same.

Installing DDSP...
This should take about 2 minutes...

ImportError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/ipyfilechooser/filechooser.py in _on_select_click(self, _b)
315 if self._callback is not None:
316 try:
--> 317 self._callback(self)
318 except TypeError:
319 # Support previous behaviour of not passing self

12 frames
/usr/local/lib/python3.10/dist-packages/keras/engine/base_layer_utils.py in
22
23 from keras import backend
---> 24 from keras.dtensor import dtensor_api as dtensor
25 from keras.utils import control_flow_util
26 from keras.utils import tf_inspect

ImportError: cannot import name 'dtensor_api' from 'keras.dtensor' (/usr/local/lib/python3.10/dist-packages/keras/dtensor/init.py)

@fhog
Copy link

fhog commented Nov 21, 2023

Hi, it seems that we are more and more having the same issue 👍
If someone get infos about that...

Installing DDSP...
This should take about 2 minutes...

ImportError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/ipyfilechooser/filechooser.py in _on_select_click(self, _b)
315 if self._callback is not None:
316 try:
--> 317 self._callback(self)
318 except TypeError:
319 # Support previous behaviour of not passing self

12 frames
/usr/local/lib/python3.10/dist-packages/keras/engine/base_layer_utils.py in
22
23 from keras import backend
---> 24 from keras.dtensor import dtensor_api as dtensor
25 from keras.utils import control_flow_util
26 from keras.utils import tf_inspect

ImportError: cannot import name 'dtensor_api' from 'keras.dtensor' (/usr/local/lib/python3.10/dist-packages/keras/dtensor/init.py)

@AJourdan
Copy link

AJourdan commented Jan 2, 2024

Also getting the same error - Anyone figure it out?

@yk7244
Copy link

yk7244 commented Jan 5, 2024

Before running the training code, try this

!pip uninstall -y keras tensorflow tensorflow-probability absl-py astunparse flatbuffers gast google-pasta grpcio h5py keras keras-preprocessing libclang numpy opt-einsum protobuf setuptools six tensorboard tensorflow-io-gcs-filesystem termcolor tf-estimator-nightly typing-extensions wrapt !pip install --disable-pip-version-check --no-cache-dir tensorflow==2.11.0 !pip install tensorflow-probability==0.15.0 !pip install keras==2.11.0

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

6 participants