← 开源
AdityaNG

kan-gpt

The PyTorch implementation of Generative Pre-trained Transformers (GPTs) using Kolmogorov-Arnold Networks (KANs) for language modeling

Model DevelopmentArchitecturePython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
725
Star
54
Fork
+0
本周
7
贡献者
创建于 2024-05-02 · 更新于 2026-10-01 · 今日第 14501 名
主要开发者

AdityaNG/kan-gpt 排名第 14,501,有 725 个星标。

同类别比较

AdityaNG/kan-gpt 排名第 14,501,此处有 8 个同类条目;yanpanlau/DDPG-Keras-Torcs 排名第 14,499。

同类别比较
名称排名指标
openai/imitation14,495
语言:
Python
星标数:
726
分叉数:
189
简介:
Code for the paper "Generative Adversarial Imitation Learning"
pytorch/elastic14,497
语言:
Python
星标数:
726
分叉数:
98
简介:
PyTorch elastic training
swz30/MIRNet14,498
语言:
Python
星标数:
726
分叉数:
96
简介:
[ECCV 2020] Learning Enriched Features for Real Image Restoration and Enhancement. SOTA results for image denoising, super-resolution, and image enhancement.
yanpanlau/DDPG-Keras-Torcs14,499
语言:
Python
星标数:
726
分叉数:
261
简介:
Using Keras and Deep Deterministic Policy Gradient to play TORCS
ansleliu/LightNet14,504
语言:
Python
星标数:
725
分叉数:
174
简介:
LightNet: Light-weight Networks for Semantic Image Segmentation (Cityscapes and Mapillary Vistas Dataset)
hongsukchoi/Pose2Mesh_RELEASE14,507
语言:
Python
星标数:
725
分叉数:
72
简介:
Official Pytorch implementation of "Pose2Mesh: Graph Convolutional Network for 3D Human Pose and Mesh Recovery from a 2D Human Pose", ECCV 2020
inception-project/inception14,508
语言:
Java
星标数:
725
分叉数:
171
简介:
INCEpTION provides a semantic annotation platform offering intelligent annotation assistance and knowledge management.
lucidrains/x-clip14,511
语言:
Python
星标数:
725
分叉数:
48
简介:
A concise but complete implementation of CLIP with various experimental improvements from recent papers
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Architecture
星标数725
分叉数54
贡献者7
创建日期2024-05-02
更新日期2026-10-01
1 天星标数0
7 天星标数0
排名14,501
上次排名14,347
排名变化-154
7 天星标排名14,508
上次 7 天星标排名14,522
7 天星标排名变化14
总星标排名14,460
上次总星标排名14,431
总星标排名变化-29
国家India
README 摘录

KAN-GPT The PyTorch implementation of Generative Pre-trained Transformers (GPTs) using Kolmogorov-Arnold Networks (KANs) for language modeling Install it from PyPI Citation If you find our work useful cite us! The following is an outline of how to use the model: Setup for Development Train Use the following dummy script to make sure everything is working as expected Then make use of the training script Prompt You can prompt the model to produce text as follows Results We

train and compare KAN-GPT with an equivalent MLP-GPT model on the Tiny Shakespeare dataset. We observe that the KAN-GPT performs slightly better than the MLP-GPT. We are looking into further experiments to dive deeper. txt constraints [ ] Define pydantic model for training and sweep args [ ] Pruning the package, get rid of unused code [ ] Training script to PyTorch Lighting [x] Documentation: [x] Integrate with efficient-kan [x] Test Cases [x] KAN: Forward-Backward test [x] GPT: Forward-Backward

test [x] KAN_GPT: Forward-Backward test [x] EFFICIENT_KAN: Forward-Backward test Development Read the CONTRIBUTING. References minGPT pykan webtext tinyshakespeare

常见问题

记录了多少星标和分叉?

AdityaNG/kan-gpt 有 725 个星标和 54 个分叉。

仓库排名是多少?

AdityaNG/kan-gpt 排名第 14,501。

记录的语言和类别是什么?

AdityaNG/kan-gpt 有 725 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

AdityaNG/kan-gpt 与 yanpanlau/DDPG-Keras-Torcs 比较,后者排名第 14,499,有 726 个星标。

README

KAN-GPT

The PyTorch implementation of Generative Pre-trained Transformers (GPTs) using Kolmogorov-Arnold Networks (KANs) for language modeling

Install it from PyPI

pip install kan_gpt

Citation

If you find our work useful cite us!

@misc{GANESH2024KANGPT,
  author       = {Aditya Nalgunda Ganesh},
  title        = {KAN-GPT: The PyTorch implementation of Generative Pre-trained Transformers (GPTs) using Kolmogorov-Arnold Networks (KANs) for language modeling},
  year         = {2024},
  month        = {May},
  note         = {Release 1.0.0, 9th May 2024},
  url          = {https://github.com/AdityaNG/kan-gpt/}
}

Usage

Refer to the KAN_GPT.ipynb and kan_gpt/prompt.py for usage examples. The following is an outline of how to use the model:

from kan_gpt.model import GPT
from transformers import GPT2Tokenizer

model_config = GPT.get_default_config()
model_config.model_type = "gpt2"
model_config.vocab_size = 50257
model_config.block_size = 1024
model = GPT(model_config)

tokenizer = GPT2Tokenizer.from_pretrained('gpt2')

prompt = "Bangalore is often described as the "

prompt_encoded = tokenizer.encode(
  text=prompt, add_special_tokens=False
)

x = torch.tensor(prompt_encoded).unsqueeze(0)

model.eval()
y = model.generate(x, 50)  # sample 50 tokens

result = tokenizer.decode(y[0])

print(result)

# Bangalore is often described as the Silicon Valley of India.
# The city has witnessed rapid growth in the past two decades.....

Setup for Development

# Download Repo
git clone https://github.com/AdityaNG/kan-gpt
cd kan-gpt
git pull

# Download Dataset
python3 -m kan_gpt.download_dataset --dataset tinyshakespeare
python3 -m kan_gpt.download_dataset --dataset mnist
python3 -m kan_gpt.download_dataset --dataset webtext

# Install dependencies for development
pip install -r requirements.txt
pip install -e .

Train

Use the following dummy script to make sure everything is working as expected

WANDB_MODE=offline CUDA_VISIBLE_DEVICE="" python3 -m kan_gpt.train --architecture MLP --batch_size 1 --dummy_dataset --device cpu --max_iters 200
WANDB_MODE=offline CUDA_VISIBLE_DEVICE="" python3 -m kan_gpt.train --architecture KAN --batch_size 1 --dummy_dataset --device cpu --max_iters 200

Then make use of the training script

python -m kan_gpt.train

Prompt

You can prompt the model to produce text as follows

python -m kan_gpt.prompt --prompt "Bangalore is often described as the " --model_path (checkpoint)

Results

We train and compare KAN-GPT with an equivalent MLP-GPT model on the Tiny Shakespeare dataset. We observe that the KAN-GPT performs slightly better than the MLP-GPT. We are looking into further experiments to dive deeper. The results are shown below:

Metrics

TODOs

  • [x] Integrate minGPT and pykan
  • [x] Dataset downloading script for WebText
  • [x] PyTorch Dataset parser for WebText
  • [x] PyTorch Dataset parser for tinyshakespeare
  • [x] Mini training POC for KAN-GPT
    • [x] Integrate KAN training logic from KAN.train_kan
    • [x] Train a dummy batch w/o any memory issues
  • [x] Mini training POC for MLP-GPT
  • [x] Train MLP-GPT on the webtext dataset as a baseline
  • [x] Train KAN-GPT on the webtext dataset as a baseline
  • [x] Metrics comparing KAN-GPT and MLP-GPT
  • [x] Auto Save checkpoints
  • [x] Auto Save checkpoints to W&B
  • [ ] Auto Download model weights from git / huggingface
  • [x] W&B hyperparam sweep script
  • [x] Script to load checkpoint in interactive mode
  • [ ] Reduce requrements.txt constraints
  • [ ] Define pydantic model for training and sweep args
  • [ ] Pruning the package, get rid of unused code
  • [ ] Training script to PyTorch Lighting
  • [x] Documentation: mkdocs gh-deploy
  • [x] Integrate with efficient-kan
  • [x] Test Cases
    • [x] KAN: Forward-Backward test
    • [x] GPT: Forward-Backward test
    • [x] KAN_GPT: Forward-Backward test
    • [x] EFFICIENT_KAN: Forward-Backward test

Development

Read the CONTRIBUTING.md file.

References

排名相邻
同类项目