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

Saving caffemodel and solverstate #77

Closed
jaewoosong opened this issue Feb 17, 2016 · 2 comments
Closed

Saving caffemodel and solverstate #77

jaewoosong opened this issue Feb 17, 2016 · 2 comments

Comments

@jaewoosong
Copy link
Contributor

Hi! Always thank you for this great program. May I ask about saving caffemodel and solverstate?

I tried to save the trained model as .caffemodel and .solverstate files. It seemed that the snapshot of cifar10_quick_solver.prototxt did not work in SparkNet.

I found commented lines in CifarDBApp.scala:

if (i % 10 == 0) {
  net.setWeights(netWeights)
  net.saveWeightsToFile("/root/weights/" + i.toString + ".caffemodel")
}

But I could not understand how to use those lines. At the same time, it seems that many things have been changed with recent update so I guess even if I had found out how to use those lines, it would not be applicable to the new version of SparkNet.

I feel sorry to ask a question because I can see that you are very busy. A lot of code update! Thank you for always responding to my issue writings and questions.

@robertnishihara
Copy link
Member

Good point, saving models is critical, so we need to reintroduce that code (it's no longer in the master).

In the code snippet above, we first move the weights from the WeightCollection object netWeights into the Net object net. Then we call the net's method saveWeightsToFile which calls a caffe method that stores a snapshot of the weights.

We could save the WeightCollection object directly, but we probably want to provide an interface for reading/writing .caffemodel files so that SparkNet interfaces nicely with Caffe.

@jaewoosong
Copy link
Contributor Author

Thank you!

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