efficient-kan
efficient-kan copied to clipboard
Is there anyway that I can save the model for later use
Hi, thank you for your work. As for the title, I would like some ways to save the model for inference. I have tried pickle dump but it does not work. Thanks
You can use:
torch.save(model, your_model_path)
Then load it to do inference:
model = torch.load(model_path) model.eval()
For more information: https://pytorch.org/tutorials/beginner/saving_loading_models.html
Have you tried this? Not work for me. Because the torch saving seems to use the pickle too.
AttributeError: Can't pickle local object 'Symbolic_KANLayer.__init__.<locals>.<listcomp>.<listcomp>.<lambda>'
Can you show me your code?
@binhnguyen7tiki Please post the full error message.
@binhna I don't think my implementation includes Symbolic_KANLayer
. It should be part of the official implementation.
BTW, it seems the two accounts are the same person? Correct me if I'm wrong.
Have you tried this? Not work for me. Because the torch saving seems to use the pickle too.
AttributeError: Can't pickle local object 'Symbolic_KANLayer.__init__.<locals>.<listcomp>.<listcomp>.<lambda>'
Do you use the original KAN (https://github.com/KindXiaoming/pykan) for training your model? Then, ask them there better.
Seemingly unrelated to this repo. Close for now and if I'm wrong I'll reopen it.
@Blealtan @hoangthangta sorry for the late reply, and yes, I checked the code again and it was the original KAN indeed. I switched to efficient-kan now and everything seems to be fine. Thank you guys for your help. PS: @Blealtan correct! it was the same guy, I accidentally used my work account in the first place.