Skip to content

Commit

Permalink
Add 'snapshot_after_train' to SolverParameter to override the final
Browse files Browse the repository at this point in the history
snapshot.
  • Loading branch information
jeffdonahue committed Aug 4, 2014
1 parent aae50aa commit 8b449d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/caffe/proto/caffe.proto
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ message SolverParameter {
// If true, print information about the state of the net that may help with
// debugging learning problems.
optional bool debug_info = 23 [default = false];

// If false, don't save a snapshot after training finishes.
optional bool snapshot_after_train = 28 [default = true];
}

// A message that stores the solver snapshots
Expand Down
5 changes: 3 additions & 2 deletions src/caffe/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ void Solver<Dtype>::Solve(const char* resume_file) {
ComputeUpdateValue();
net_->Update();
}
// Always save a snapshot after optimization.
Snapshot();
// Always save a snapshot after optimization, unless overridden by setting
// snapshot_after_train := false.
if (param_.snapshot_after_train()) { Snapshot(); }
// After the optimization is done, run an additional train and test pass to
// display the train and test loss/outputs if appropriate (based on the
// display and test_interval settings, respectively). Unlike in the rest of
Expand Down

0 comments on commit 8b449d0

Please sign in to comment.