提交 da3e84a6 编写于 作者: Q qiaolongfei

change trainer_id

上级 4f366be4
...@@ -56,7 +56,7 @@ def convolutional_neural_network(img): ...@@ -56,7 +56,7 @@ def convolutional_neural_network(img):
def main(): def main():
paddle.init(use_gpu=False, trainer_count=1, trainer_id=1) paddle.init(use_gpu=False, trainer_count=1)
# define network topology # define network topology
images = paddle.layer.data( images = paddle.layer.data(
...@@ -92,9 +92,6 @@ def main(): ...@@ -92,9 +92,6 @@ def main():
print "Pass %d, Batch %d, Cost %f, %s" % ( print "Pass %d, Batch %d, Cost %f, %s" % (
event.pass_id, event.batch_id, event.cost, event.metrics) event.pass_id, event.batch_id, event.cost, event.metrics)
with gzip.open('params.tar.gz', 'w') as f:
parameters.to_tar(f)
elif isinstance(event, paddle.event.EndPass): elif isinstance(event, paddle.event.EndPass):
result = trainer.test(reader=paddle.batch( result = trainer.test(reader=paddle.batch(
paddle.dataset.mnist.test(), batch_size=128)) paddle.dataset.mnist.test(), batch_size=128))
......
...@@ -4,7 +4,7 @@ import paddle.v2.dataset.uci_housing as uci_housing ...@@ -4,7 +4,7 @@ import paddle.v2.dataset.uci_housing as uci_housing
def main(): def main():
# init # init
paddle.init(use_gpu=False, trainer_count=1, trainer_id=1) paddle.init(use_gpu=False, trainer_count=1)
# network config # network config
x = paddle.layer.data(name='x', type=paddle.data_type.dense_vector(13)) x = paddle.layer.data(name='x', type=paddle.data_type.dense_vector(13))
......
...@@ -39,8 +39,8 @@ void NewRemoteParameterUpdater::init( ...@@ -39,8 +39,8 @@ void NewRemoteParameterUpdater::init(
} }
// create parameter server client. // create parameter server client.
parameterClient_ = parameterClient_ = paddle_new_pserver_client((char *)pserverSpec_.c_str(),
paddle_new_pserver_client((char *)pserverSpec_.c_str(), FLAGS_trainer_id); FLAGS_trainer_id == 0);
// init names_ for get parameter through paddle_cclient // init names_ for get parameter through paddle_cclient
names_ = (char **)malloc(parameterSize() * sizeof(char *)); names_ = (char **)malloc(parameterSize() * sizeof(char *));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册