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

关于tfkan的安装 #14

Open
yelou2022 opened this issue Aug 27, 2024 · 6 comments
Open

关于tfkan的安装 #14

yelou2022 opened this issue Aug 27, 2024 · 6 comments

Comments

@yelou2022
Copy link

yelou2022 commented Aug 27, 2024

你好,这是我目前看到的一个最好的关于kan的tensorflow实现,我在google colab也能初步运行起来,但是当我准备进行下一步研究时,在环境配置方面遇到了一些问题,由于国内限速的问题,使用pip进行安装的过程并不顺利,而这个库似乎也没被一些常用的镜像源添加,所以无法通过配置镜像进行安装,我看了一下版本要求,里面只列举tensorflow和keras,是否说明tfkan只依赖于这两个包,只要安装这两个符合要求的包,就能通过克隆库的方式直接使用?另外,你们是否有打算配置一个conda渠道,以便研究人员能通过conda来安装你们的库?我想这应该有利于推广你们的成果

祝好!

@ZPZhou-lab
Copy link
Owner

ZPZhou-lab commented Aug 27, 2024

I build conda packages and you can try with:

conda install tfkan -c xaviercamel

The package has not been add into default channel for conda, so we need to add -c xaviercamel for now.

Hope this can help you😄

Best!

@yelou2022
Copy link
Author

yelou2022 commented Aug 27, 2024

thanks, you are the best developer! @ZPZhou-lab
you can update the readme file, which will help more people.

@ZPZhou-lab
Copy link
Owner

I received an email and it seems that you have encountered some troubles in the environment configuration. The following steps may help u😊

  • step 1: create a new env with conda
conda create -n tfkan python=3.9
conda activate tfkan
  • step 2: install cudatoolkit and cudnn for GPU support
conda install -c conda-forge cudatoolkit=11.3.1 cudnn=8.2.1
 
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/' > $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh

before next step, we need sign out and sign back (or close and re-open your terminal)

  • step 3: install tensorflow and tfkan with conda
conda activate tfkan
conda install xaviercamel::tfkan tensorflow==2.12.0=gpu_py39hc0f3f85_0

The above process takes tensorFlow==2.12 as an example. When installing TensorFlow using Conda, please pay attention to the compatibility between tensorflow version and cudatoolkit, cudnn version, and remember to specify TensorFlow with GPU build (i.e. tensorflow==2.x.x=gpu_pyxxxxxxxxx)

  • step 4: test installation
import tensorflow as tf
import tfkan
tf.config.list_physical_devices('GPU')

Now, you can use tensorflow and tfkan with GPU.

@github-staff github-staff deleted a comment from yelou2022 Aug 27, 2024
@yelou2022
Copy link
Author

@ZPZhou-lab
I was pleasantly surprised by your reply efficiency. I tried your steps, but it still said that the GPU was unavailable. This may be a limitation of my platform environment, but I found an alternative solution:

  1. create a tensorflow environment with a GPU version (mine is 2.6.0, python=3.9.7).
  2. use the git command to clone the library (note: do not use the pip install command later).
  3. modify the command to import tfkan:
from tfkan import layers
from tfkan.layers import DenseKAN, Conv1DKAN

replace with:

from tfkan.tfkan import layers
from tfkan.tfkan.layers import DenseKAN, Conv1DKAN

Through the above steps, I successfully ran tfkan in the 2.6.0 tensorflow-GPU environment, and now I am trying to apply the effect. I hope this can provide some help.

@JunXinVan
Copy link

您好,在使用过程中我发现Conve3D会导致原先五维的输入数据变成四维,请问这是为什么?是故意这样设计的吗?您辛苦!

@yelou2022
Copy link
Author

您好,在使用过程中我发现Conve3D会导致原先五维的输入数据变成四维,请问这是为什么?是故意这样设计的吗?您辛苦!

@ZPZhou-lab hello, this question needs you to explain.

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

7 participants
@ZPZhou-lab @yelou2022 @JunXinVan and others