Expose `Solver::Snapshot` to pycaffe #3082

Merged
merged 2 commits into from Oct 31, 2015

Conversation

Projects
None yet
8 participants
Contributor

gustavla commented Sep 18, 2015

This addresses #3077, making it possible to manually save a snapshot (caffemodel+solverstate) from Python.

On a related note, does it also make sense to expose Solver::TestAll, so that it's possible to manually instigate a test run through Python?

@gustavla gustavla Expose `Snapshot` to pycaffe
- Solver::Snapshot is made public
- It is also added as `snapshot` to pycaffe

Addressing #3077
b4f9add
Contributor

longjon commented Sep 19, 2015

Looks good -- I wonder if we could have a basic test though?

Exposing TestAll in a different PR sounds good to me.

Contributor

gustavla commented Oct 6, 2015

Sorry for delay on this. I added a test that runs solver.snapshot() and checks if the expected files were generated.

@shelhamer shelhamer added a commit that referenced this pull request Oct 31, 2015

@shelhamer shelhamer Merge pull request #3082 from gustavla/pycaffe-snapshot
Expose `Solver::Snapshot` to pycaffe
f5fd18b

@shelhamer shelhamer merged commit f5fd18b into BVLC:master Oct 31, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Owner

shelhamer commented Oct 31, 2015

Thanks for the pycaffe extension @gustavla!

mpkuse commented Aug 9, 2016

Is there also a way to load a snapshot into the solver with pycaffe?

Hi @gustavla , could you please provide an example on how to use this feature?
in #3077 you mentioned that you wrote a SIGTERM interrupt handler?
Thanks!

rayryeng commented Nov 18, 2016 edited

@mpkuse Just use the restore method that accompanies the solver. The input is the path to your .solverstate file that gets saved during snapshots --> solver.restore('your_solverstate_file.solverstate'). It's also mentioned in the Python section under Interfaces in the Caffe documentation: http://caffe.berkeleyvision.org/tutorial/interfaces.html

VasLem commented Apr 30, 2017

Is there a way to set snapshot file name from inside a Python program, or is it necessary to have the name inside the solver prototxt from the beginning? Sorry if I ask something obvious, but there is no documentation, apart from this page and http://caffe.berkeleyvision.org/tutorial/interfaces.html.

Member

naibaf7 commented Apr 30, 2017

@VasLem
This example demonstrates the Python interface to it's full extent. However do note some options may only be available on the opencl branch and not (yet) mainline. But it should give you a good idea of it:
https://github.com/naibaf7/opencl_caffe_examples/blob/master/mnist_lenet/mnist_lenet.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment