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

svn commit: r1696293 - /incubator/singa/site/trunk/content/markdown/docs/cnn.md

Author: jinyang
Date: Mon Aug 17 14:26:35 2015
New Revision: 1696293

URL: http://svn.apache.org/r1696293
Log:
CMS commit to singa by jinyang

Modified:
    incubator/singa/site/trunk/content/markdown/docs/cnn.md

Modified: incubator/singa/site/trunk/content/markdown/docs/cnn.md
URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/content/markdown/docs/cnn.md?rev=1696293&r1=1696292&r2=1696293&view=diff
==============================================================================
--- incubator/singa/site/trunk/content/markdown/docs/cnn.md (original)
+++ incubator/singa/site/trunk/content/markdown/docs/cnn.md Mon Aug 17 14:26:35 2015
@@ -19,16 +19,45 @@ Notice:    Licensed to the Apache Softwa
 This example will show you how to use SINGA to train a CNN model using cifar10 dataset.
 
 ### Prepare for the data
-* Run the command `make download` and `make create`  in the folder `example/cifar10/` to download cifar10 dataset
-and prepare for the training and testing datashard.
-If you got the error no Makefile detected, rename Makefile.example to Makefile.
-
-### Set model and cluster configuration.
-* If you just want to use the training model provided in this example, you can just use model.conf file in current directory.
- In this example, we define a CNN model that contains 3 convolution+relu+maxpooling+normalization layers.
+* First go to the `example/cifar10/` folder for preparing the dataset. There should be a makefile example called Makefile.example in the folder. Run the command `cp Makefile.example Makefile` to generate the makefile.
+Then run the command `make download` and `make create`  in the current folder to download cifar10 dataset and prepare for the training and testing datashard. 
+
+### Set job configuration.
+* If you just want to use the training model provided in this example, you can just use job.conf file in current directory. Fig. 1 gives an example of CNN struture. In this example, we define a CNN model that contains 3 convolution+relu+maxpooling+normalization layers. 
+If you want to learn more about how it is configured, you can go to [Model Configuration](http://singa.incubator.apache.org/docs/model-config.html) to get details. 
+
+<div style = "text-align: center">
+<img src = "../images/cnn_example.png" style = "width: 280px"> <br/>Fig. 1: CNN example </img>
+</div>
+
 
 ### Run SINGA
-* Run the command `./bin/singa-run.sh -workspace=examples/cifar10` in the root folder of SINGA
+* All script of SINGA should be run in the root folder of SINGA.
+First you need to start the zookeeper service if zookeeper is not started. The command is `./bin/zk-service start`. 
+Then you can run the command `./bin/singa-run.sh -conf examples/cifar10/job.conf` to start a SINGA job using examples/cifar10/job.conf as the job configuration.
+After it is started, you should get a screenshots like the following:
+
+    xxx@yyy:zzz/incubator-singa$ ./bin/singa-run.sh -conf examples/cifar10/job.conf
+    Unique JOB_ID is 2
+    Record job information to /tmp/singa-log/job-info/job-2-20150817-055601
+    Executing : ./singa -conf /xxx/incubator-singa/examples/cifar10/job.conf -singa_conf /xxx/incubator-singa/conf/singa.conf -singa_job 2
+    E0817 06:56:18.868259 33849 cluster.cc:51] proc #0 -> 192.168.5.128:49152 (pid = 33849)
+    E0817 06:56:18.928452 33871 server.cc:36] Server (group = 0, id = 0) start
+    E0817 06:56:18.928469 33872 worker.cc:134] Worker (group = 0, id = 0) start
+    E0817 06:57:13.657302 33849 trainer.cc:373] Test step-0, loss : 2.302588, accuracy : 0.077900
+    E0817 06:57:17.626708 33849 trainer.cc:373] Train step-0, loss : 2.302578, accuracy : 0.062500
+    E0817 06:57:24.142645 33849 trainer.cc:373] Train step-30, loss : 2.302404, accuracy : 0.131250
+    E0817 06:57:30.813354 33849 trainer.cc:373] Train step-60, loss : 2.302248, accuracy : 0.156250
+    E0817 06:57:37.556655 33849 trainer.cc:373] Train step-90, loss : 2.301849, accuracy : 0.175000
+    E0817 06:57:44.971276 33849 trainer.cc:373] Train step-120, loss : 2.301077, accuracy : 0.137500
+    E0817 06:57:51.801949 33849 trainer.cc:373] Train step-150, loss : 2.300410, accuracy : 0.135417
+    E0817 06:57:58.682281 33849 trainer.cc:373] Train step-180, loss : 2.300067, accuracy : 0.127083
+    E0817 06:58:05.578366 33849 trainer.cc:373] Train step-210, loss : 2.300143, accuracy : 0.154167
+    E0817 06:58:12.518497 33849 trainer.cc:373] Train step-240, loss : 2.295912, accuracy : 0.185417
+
+After the training of some steps (depends on the setting) or the job is finished, SINGA will checkpoint the current parameter. In the next time, you can train (or use for your application) by loading the checkpoint. Please refer to [Checkpoint](http://singa.incubator.apache.org/docs/checkpoint.html) for the use of checkpoint.
 
 ### Build your own model
-* If you want to specify you own model, then you need to decribe  it in the model.conf file. It should contain the neurualnet structure, training algorithm(backforward or contrastive divergence etc.), SGD update algorithm(e.g. Adagrad), number of training/test steps and training/test frequency, and display features and etc. SINGA will read model.conf as a Google protobuf class [ModelProto](https://github.com/apache/incubator-singa/blob/master/src/proto/model.proto). You can also refer to the [programming model](http://singa.incubator.apache.org/docs/programming-model.html) to get details.
+* If you want to specify you own model, then you need to decribe  it in the job.conf file. It should contain the neurualnet structure, training algorithm(backforward or contrastive divergence etc.), SGD update algorithm(e.g. Adagrad), number of training/test steps and training/test frequency, and display features and etc. SINGA will read job.conf as a Google protobuf class [JobProto](../src/proto/job.proto). You can also refer to the [Programmer Guide](http://singa.incubator.apache.org/docs/programmer-guide.html) to get details. 
+
+