Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export_net , read_net ? #26

Open
IgorWojas opened this issue Nov 12, 2023 · 3 comments
Open

export_net , read_net ? #26

IgorWojas opened this issue Nov 12, 2023 · 3 comments

Comments

@IgorWojas
Copy link

Hello and thank you for this gem. I would like to know more about those 2 functions - export_net and read_net. There is no explanation in the doc. I see that export_net creates 2 files: one is net info and the second I assume is weights? How to use read_net? Do i put it after or instead of init? Any info highly appreciated. Thanks!

@IgorWojas
Copy link
Author

IgorWojas commented Nov 14, 2023

Ok i think i figured it out. For ease of explanation let's split the process into 3 programs.

  1. First program creates and trains the model initially. You will need to set it like in the examples. After training (nn.fit) save the model : nn.export_net("models", "model1")

  2. Second program will load the model and continue training. Create a folder "Load". Copy all files created by the first program to your Load folder in the second program. Here you only need to set everything as before excepet nn.init. Set learning rate lower then in program 1 so your loss doesnt spike in the second epoch. Put nn.read_net("Load", "model1") INSTEAD od nn.init then train it some more (nn.fit) then after training save the model to your Save folder - nn.export_net("Save","model1"). If you want to train even more, take all files from Save folder and put into Load folder. Then DELETE the Save folder. If loss value is all over the place decrease lrate in optimiser.

  3. Third program is for prediction only. Create a "Load" folder and put desired files in it. You only need nn.read_net("Load", "model1") then nn.predict.

EDIT:bloopers

EDIT2: Loading and saving process is painfully slow, if anyone has anything to add please do.

@giovastabile
Copy link
Collaborator

Hi @IgorWojas, yes it is right. I was the one who wrote these functions some time ago.... Not sure it is highly optimized.

How the functions work can be seen in tutorials/test1/test1.cpp

@IgorWojas
Copy link
Author

@giovastabile Thank you for your answer. I didn't mean to sound ungrateful. The long time it takes to save/load a model is probably a problem on my side. Since I have your attention - would you recommend a different non-gpu library for learning/testing? Preferably something with a community feedback? Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants