TorchKAN: A Simplified KAN Model (Version: 0)
This project demonstrates the training, validation, and quantization of the KAN model using PyTorch with CUDA acceleration. The torchkan model evaluates performance on the MNIST dataset.
Project Status: Under Development
The KAN model has shown promising results amidst various GAMs since the 1980s. This implementation, inspired by various sources, achieves over 97% accuracy with an eval time of 0.6 seconds and the quantised model achieves under 0.55 seconds on the MNIST dataset in 8 epochs on a Ubuntu 22.04 OS with a single Nvidia RTX4090.
As this model is still under study, further exploration into its full capabilities is ongoing.
Prerequisites
Ensure you have the following installed on your system:
- Python (version 3.9 or higher)
- CUDA Toolkit (corresponding to your PyTorch installation's CUDA version)
- cuDNN (compatible with your installed CUDA Toolkit)
Installation
Tested on MacOS and Linux.
1. Clone the Repository
Clone the torchkan repository and set up the project environment:
git clone https://github.com/1ssb/torchkan.git
cd torchkan
pip install -r requirements.txt
Alternately PyPi install as:
pip install torchKAN
2. Configure CUDA environment variables if they are not already set:
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
3. Configure Weights & Biases (wandb)
To track experiments and model performance with wandb:
- Set Up wandb Account:
- Sign up or log in at Weights & Biases.
- Find your API key in your account settings.
- Initialize wandb in Your Project:
Before running the training script, initialize wandb:
wandb login
When prompted, enter your API key. This will link your script executions to your wandb account.
- Make sure to change the Entity name in the
mnist.pyfile to your username instead of1ssb
This script will train the model, validate it, and log performance metrics using wandb.
Contact
For any inquiries or support, contact: Subhransu.Bhattacharjee@anu.edu.au
Cite this Project
If you use this project in your research or wish to refer to the baseline results, please use the following BibTeX entry.
@misc{torchkan,
author = {Subhransu S. Bhattacharjee},
title = {TorchKAN},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/1ssb/torchkan/}}
}
Contributions
Contributions are welcome. Please raise issues as necessary after commit "Fin.", scheduled end-June, 2024. The code is licensed under the MIT License.
References
- [0] Ziming Liu et al., "KAN: Kolmogorov-Arnold Networks", 2024, arXiv. https://arxiv.org/abs/2404.19756
- [1] https://github.com/KindXiaoming/pykan
- [2] https://github.com/Blealtan/efficient-kan
Metadata
Release files for TorchKAN 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| TorchKAN-0.1.1.tar.gz | 3.6 kB | Without provenance | Details for TorchKAN-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| TorchKAN-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for TorchKAN-0.1.1-py3-none-any.whl |
Total release size: 7.1 kB
Release files / TorchKAN-0.1.1.tar.gz
| Download URL | TorchKAN-0.1.1.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06e3529df4e15feca598bd6dcf25de1b6a75e03e897b182026ceb49c64e743af
|
|
BLAKE2b-256 checksum How to use checksums |
1b176e4e99e41a0bdee061a8814b3dc65eb046df83044429c1461d71a3609779
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.4
|
Release files / TorchKAN-0.1.1-py3-none-any.whl
| Download URL | TorchKAN-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5dc5b99c1fd0246c6431254e7b04cd5e0b6bc6079456e87c064a1d0d983b3e1
|
|
BLAKE2b-256 checksum How to use checksums |
aefda1a2479ffa4c04ad70f3f12291d986487225d991d14185ef3827b32d4a79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.4
|
Security for TorchKAN 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.