KindXiaoming / pykan

Kolmogorov Arnold Networks
MIT License
14.94k stars 1.38k forks source link

How can Train KAN on batches of data #214

Closed lukmanulhakeem97 closed 3 months ago

lukmanulhakeem97 commented 5 months ago

While training KAN using entire samples say 10000, end up in memory overflow issue. Instead of giving entire data at once on "dataset" dict, can we train KAN on small batches of data like normally do on ANN?

KindXiaoming commented 5 months ago

Hi, you can pass the batch argument in train: https://github.com/KindXiaoming/pykan/blob/master/kan/KAN.py#L761

lukmanulhakeem97 commented 5 months ago

thanks @KindXiaoming, got it 👍

HajiDr commented 5 months ago

@KindXiaoming can you explain how does the batch argument works in case of KANs. It seems only training and testing on the batch size specified per step. Or i got it wrong?

sparcycram commented 4 months ago

@KindXiaoming

Any thoughts appreciated

I am still having problems OutOfMemoryError with large datasets. Is it possible to modify the code to use Dataloader and pass train_loader and test_loader to train instead of dataset?

So edit this line

def train(self, dataset, opt="LBFGS", steps=100, ......

KindXiaoming commented 3 months ago

@sparcycram please try the speed mode model = model.speed(). tutorial: https://github.com/KindXiaoming/pykan/blob/master/tutorials/Example_2_speed_up.ipynb. You need to update to the most recent version 0.2.0