You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by wa...@apache.org on 2015/08/15 10:11:17 UTC

[04/12] incubator-singa git commit: SINGA-54 Refactor job configuration to move fields in ModelProto out

SINGA-54 Refactor job configuration to move fields in ModelProto out

Tested with mnist and cifar examples.
Four components are necessary for submitting a job, namely, neuralnet, alg, updater and cluster.
The configuration is now consistent with the MM paper.


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/a584da62
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/a584da62
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/a584da62

Branch: refs/heads/master
Commit: a584da62c14720768acbf9a82a6069faa48b91d2
Parents: b33e50d
Author: Wei Wang <wa...@comp.nus.edu.sg>
Authored: Fri Aug 14 16:25:10 2015 +0800
Committer: Wei Wang <wa...@comp.nus.edu.sg>
Committed: Sat Aug 15 14:59:11 2015 +0800

----------------------------------------------------------------------
 src/proto/job.proto | 38 ++++++++++++++++++++++++++++++++++++--
 src/utils/param.cc  |  2 +-
 2 files changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/a584da62/src/proto/job.proto
----------------------------------------------------------------------
diff --git a/src/proto/job.proto b/src/proto/job.proto
index f38e261..dbbfc61 100644
--- a/src/proto/job.proto
+++ b/src/proto/job.proto
@@ -79,7 +79,6 @@ message JobProto {
   optional int32 id = 92 [default = -1];
 }
 
-// -----------------------
 // Protos used by JobProto
 // -----------------------
 
@@ -104,7 +103,6 @@ message UpdaterProto {
   optional ExponentialProto exponential_conf = 43;
   optional InverseProto inverse_conf = 44;
   optional InverseTProto inverset_conf = 45;
-
   optional float momentum = 31 [default = 0];
   optional float weight_decay = 32 [default = 0];
   // base learning rate
@@ -237,6 +235,42 @@ message ParamProto {
 // protos for different layers
 // ---------------------------
 
+// weight matrix should be defined before bias vector
+// TODO(wangwei): separate conf for diff init method
+message ParamProto {
+  // used for identifying the same params from diff models and display deug info
+  optional string name =  1 [default = ""];
+  optional InitMethod init_method = 2 [default = kGaussian];
+  // constant init
+  optional float value = 5 [default = 1];
+  // for uniform sampling
+  optional float low = 6 [default = -1];
+  optional float high = 7 [default = 1];
+  // for gaussian sampling
+  optional float mean = 8 [default = 0];
+  optional float std = 9 [default = 1];
+  // multiplied on the global learning rate.
+  optional float learning_rate_multiplier = 15 [default = 1];
+  // multiplied on the global weight decay.
+  optional float weight_decay_multiplier = 16 [default = 1];
+
+  // name of the owner param from which this param shares the values
+  optional string share_from = 60;
+
+  // used interally
+  optional int32 id = 90;
+  // used internally
+  optional int32 owner = 91 [default = -1];
+  // partition dimension, -1 for no partition
+  optional int32 partition_dim = 92;
+  // usually, the program will infer the param shape
+  repeated int32 shape = 93;
+}
+
+// ---------------------------
+// protos for different layers
+// ---------------------------
+
 message RGBImageProto {
   // scale factor for each pixel
   optional float scale = 1 [default = 1.0];

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/a584da62/src/utils/param.cc
----------------------------------------------------------------------
diff --git a/src/utils/param.cc b/src/utils/param.cc
index 61173cb..2655877 100644
--- a/src/utils/param.cc
+++ b/src/utils/param.cc
@@ -43,7 +43,7 @@ void Param::InitValues(int version) {
   Tensor<cpu, 1> data(mutable_cpu_data(), Shape1(size()));
   auto random = TSingleton<Random<cpu>>::Instance();
   switch (proto_.init_method()) {
-  case ParamProto::kConstant:
+  case InitMethod::kConstant:
     data = proto_.value();
     break;
   case InitMethod::kUniform: