From a3a6997e3213d9d895e83d6c83130a060a6aafa8 Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Wed, 8 Feb 2017 19:38:32 -0800 Subject: [PATCH] Add draft new_api.md --- doc/api/new_api.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 doc/api/new_api.md diff --git a/doc/api/new_api.md b/doc/api/new_api.md new file mode 100644 index 0000000000..5a90cd1c75 --- /dev/null +++ b/doc/api/new_api.md @@ -0,0 +1,38 @@ +import yi_json + +g = 100 +def read(): + queue q; + # warmup q + for i = 0 : 1000 + q.push(read()) + yield q.shuffle_get() + +input = paddle.layer.data(...) +intermediate = paddle.layers.fc(input) +output = paddle.layer.softmax(intermediate) + +model = paddle.model.create(output) + +train(model, data_provider=read, cluster="clusterId") + +#-------------------------------------------------------------------------------- + +# 1. package, docker build, docker push +# 2. kubectl, clusterId Kuberentes job, 10 trainer containers, 5 parameter server containers + +#-------------------------------------------------------------------------------- + +def train(): + if os.environ["kube_api_server"] == nil: + docker_build() + docker_push() + kube_ctrl_start_job() + else: + rank = kube_mpi_rank() + if rank == 0: + master() + elif rank >= 15: + parameter_server() + else: + _train() -- GitLab