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

Instructions about how to install tsgm with a specific tensorflow version when you meet " No module named 'tf_keras'" or ''ImportError: keras.optimizers.legacy is not supported in Keras 3." #42

Closed
liyiersan opened this issue Mar 20, 2024 · 2 comments

Comments

@liyiersan
Copy link
Contributor

Thanks for your nice work, tsgm helps me a lot when dealing with time series data.
When installing tsgm via ''pip install tsgm'', it will automatically install the newest TensorFlow and sometimes it may cause package conflicts.
Here is an instruction about how to specify the TensorFlow, especially on GPUs.
1, Firstly, you need to make sure CUDA and the corresponding cuDNN have been correctly installed in your environment. Check it by using "nvcc -V".

nvcc -V

2, Secondly, install TensorFlow via "pip install tensorflow==2.X.X". If you correctly configure CUDA and cuDNN in your environment, tensorflow-gpu will be available.

pip install tensorflow==2.14.0 # 2.14.0 for example

You can check it by running

python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))" 

3, Install tsgm via pip.

pip install tsgm

Notes:
1, The compatible versions of CUDA, cuDNN, and TensorFlow can be found at https://tensorflow.google.cn/install/source#tested_build_configurations . Remember to change the language to English.
2, If you want to install a specific Tensorflow not compatible with your local CUDA and cuDNN. You can install it in a virtual environment by conda. Just install cudatoolkit and cudnn in your virtual environment before you install TensorFlow.

conda install cudnn=x.x.x -c conda-forge # it will automatically install cudatoolkit
conda list # check cuda and cudnn

3, Make sure the tensorflow-probability matches your TensorFlow version. see https://github.com/tensorflow/probability/releases.
4, You may need to install statsmodels manually.

Update 03/20/2024, if you install tsgm directly using pip install tsgm. Some problems may happen due to the following reasons.
1, TensorFlow 2.16.1 and tensorflow-probability 0.2.40 will be installed. However, tsgm is built based on keras2, which is not compatible with Keras3 in tf2.16+. see https://github.com/tensorflow/tensorflow/releases.
2, If you want to use tsgm, here are two ways: 1) Downgrade the TensorFlow to 2.15 or lower. 2) Do as the figure suggests.
fig
3, I suggest that authors update the docs about how to install tsgm or set a limitation on the required version of TensorFlow and tensorflow-probability.
4, Actually, I am a Pytorch user and I am not familiar with TensorFlow. TSGM is really a good repo for time series data processing. If someone is interested in constructing a Pytorch version of TSGM, please email me at zhouqian@whu.edu.cn. I am very glad to build an open-source repo of tsgm-pytorch.
5, Again, thanks the authors' great work.

@AlexanderVNikitin
Copy link
Owner

Thank you for reporting!
I've added version constraints in v0.0.5, and we will support TF 2.16 and above as a first step of moving to Keras 3 #40

By using Keras 3, we will aim to support TF, PyTorch, and Jax.

@liyiersan
Copy link
Contributor Author

Thank you for reporting! I've added version constraints in v0.0.5, and we will support TF 2.16 and above as a first step of moving to Keras 3 #40

By using Keras 3, we will aim to support TF, PyTorch, and Jax.

Thanks for your nice work. Today, I find a bug in SliceAndShuffle, please see it at #43.
TSGM really helps me a lot in my project, thanks again.

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

2 participants