ZPZhou-lab / tfkan

The tensorflow implementation of KANs
MIT License
44 stars 9 forks source link

关于tfkan的安装 #14

Open yelou2022 opened 2 months ago

yelou2022 commented 2 months ago

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

祝好!

ZPZhou-lab commented 2 months ago

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 commented 2 months ago

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

ZPZhou-lab commented 2 months ago

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

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`
```bash
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)

Now, you can use tensorflow and tfkan with GPU.

yelou2022 commented 2 months ago

@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 commented 2 months ago

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

yelou2022 commented 2 months ago

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

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