From 93b3fced796b72130b177392814b95fa3281ef19 Mon Sep 17 00:00:00 2001 From: heya02 Date: Wed, 12 Aug 2020 06:50:23 +0000 Subject: [PATCH] bug_fix --- python/paddle_fl/mpc/examples/mnist_demo/process_data.py | 1 + python/paddle_fl/mpc/examples/uci_demo/README.md | 8 ++++---- python/paddle_fl/mpc/examples/uci_demo/README_CN.md | 8 ++++---- .../uci_demo/{uci_housing_demo.py => uci_demo.py} | 0 python/paddle_fl/mpc/tests/unittests/run_test_example.sh | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) rename python/paddle_fl/mpc/examples/uci_demo/{uci_housing_demo.py => uci_demo.py} (100%) diff --git a/python/paddle_fl/mpc/examples/mnist_demo/process_data.py b/python/paddle_fl/mpc/examples/mnist_demo/process_data.py index dac24d0..0cbd017 100644 --- a/python/paddle_fl/mpc/examples/mnist_demo/process_data.py +++ b/python/paddle_fl/mpc/examples/mnist_demo/process_data.py @@ -17,6 +17,7 @@ Process data for MNIST. import numpy as np import paddle import six +import os from paddle_fl.mpc.data_utils import aby3 sample_reader = paddle.dataset.mnist.train() diff --git a/python/paddle_fl/mpc/examples/uci_demo/README.md b/python/paddle_fl/mpc/examples/uci_demo/README.md index 32ab7ad..4f48aaa 100644 --- a/python/paddle_fl/mpc/examples/uci_demo/README.md +++ b/python/paddle_fl/mpc/examples/uci_demo/README.md @@ -31,7 +31,7 @@ export REDIS_PORT=/your/redis/port Launch demo with the `run_standalone.sh` script. The concrete command is: ```bash -bash run_standalone.sh uci_housing_demo.py +bash run_standalone.sh uci_demo.py ``` The loss with cypher text format will be displayed on screen while training. At the same time, the loss data would be also save in `/tmp` directory, and the format of file name is similar to what is described in Step 1. @@ -84,9 +84,9 @@ Data owner encrypts data. Concrete operations are consistent with “Prepare Dat According to the suffix of file name, distribute encrypted data files to `/tmp ` directories of all 3 computation parties. For example, send `house_feature.part0` and `house_label.part0` to `/tmp` of party 0 with `scp` command. -#### (3). Modify uci_housing_demo.py +#### (3). Modify uci_demo.py -Each computation party makes the following modifications on `uci_housing_demo.py` according to the environment of machine. +Each computation party makes the following modifications on `uci_demo.py` according to the environment of machine. * Modify IP Information @@ -107,7 +107,7 @@ $REDIS_BIN -h $SERVER -p $PORT flushall Launch demo on each computation party with the following command, ``` -$PYTHON_EXECUTABLE uci_housing_demo.py $PARTY_ID $SERVER $PORT +$PYTHON_EXECUTABLE uci_demo.py $PARTY_ID $SERVER $PORT ``` where PYTHON_EXECUTABLE is the python which installs PaddleFL, PARTY_ID is the ID of computation party, which is 0, 1, or 2, SERVER and PORT represent the IP and port of Redis server respectively. diff --git a/python/paddle_fl/mpc/examples/uci_demo/README_CN.md b/python/paddle_fl/mpc/examples/uci_demo/README_CN.md index 76ed4fe..5fea5ff 100644 --- a/python/paddle_fl/mpc/examples/uci_demo/README_CN.md +++ b/python/paddle_fl/mpc/examples/uci_demo/README_CN.md @@ -31,7 +31,7 @@ export REDIS_PORT=/your/redis/port 然后使用`run_standalone.sh`脚本,启动并运行demo,命令如下: ```bash  -bash run_standalone.sh uci_housing_demo.py +bash run_standalone.sh uci_demo.py ``` 运行之后将在屏幕上打印训练过程中的密文loss数据,同时,对应的密文loss数据将会保存到/tmp目录下的文件中,文件命名格式类似于步骤1中所述。 @@ -85,9 +85,9 @@ fi `house_feature.part0`和`house_label.part0`发送到party0的/tmp目录下。 -#### 3. 计算party修改uci_housing_demo.py脚本 +#### 3. 计算party修改uci_demo.py脚本 -各计算party根据自己的机器环境,对uci_housing_demo.py做如下改动: +各计算party根据自己的机器环境,对uci_demo.py做如下改动: * 修改IP信息 @@ -109,7 +109,7 @@ $REDIS_BIN -h $SERVER -p $PORT flushall 在各计算party分别执行以下命令,启动demo: ``` -$PYTHON_EXECUTABLE uci_housing_demo.py $PARTY_ID $SERVER $PORT +$PYTHON_EXECUTABLE uci_demo.py $PARTY_ID $SERVER $PORT ``` 其中,PYTHON_EXECUTABLE表示自己安装了PaddleFL的python,PARTY_ID表示计算party的编号,值为0、1或2,SERVER和PORT分别表示redis server的IP地址和端口号。 diff --git a/python/paddle_fl/mpc/examples/uci_demo/uci_housing_demo.py b/python/paddle_fl/mpc/examples/uci_demo/uci_demo.py similarity index 100% rename from python/paddle_fl/mpc/examples/uci_demo/uci_housing_demo.py rename to python/paddle_fl/mpc/examples/uci_demo/uci_demo.py diff --git a/python/paddle_fl/mpc/tests/unittests/run_test_example.sh b/python/paddle_fl/mpc/tests/unittests/run_test_example.sh index 684d127..6514875 100644 --- a/python/paddle_fl/mpc/tests/unittests/run_test_example.sh +++ b/python/paddle_fl/mpc/tests/unittests/run_test_example.sh @@ -1,8 +1,8 @@ #!/bin/bash # set redis server ip and port for test -export TEST_REDIS_IP="test_redis_server_ip" -export TEST_REDIS_PORT="test_redis_port" +export TEST_REDIS_IP=${LOCALHOST} +export TEST_REDIS_PORT=${REDIS_PORT} # unittest command PYTHON_TEST="python -m unittest" -- GitLab