提交 120bf132 编写于 作者: P pkuliuliu

fix params error for lenet-dp demo in tutorial

上级 4ea0317a
...@@ -70,7 +70,7 @@ import mindspore.common.dtype as mstype ...@@ -70,7 +70,7 @@ import mindspore.common.dtype as mstype
from mindarmour.diff_privacy import DPModel from mindarmour.diff_privacy import DPModel
from mindarmour.diff_privacy import PrivacyMonitorFactory from mindarmour.diff_privacy import PrivacyMonitorFactory
from mindarmour.diff_privacy import NoiseMechanismsFacotry from mindarmour.diff_privacy import NoiseMechanismsFactory
from mindarmour.diff_privacy import ClipMechanismsFactory from mindarmour.diff_privacy import ClipMechanismsFactory
from mindarmour.utils.logger import LogUtil from mindarmour.utils.logger import LogUtil
from lenet5_net import LeNet5 from lenet5_net import LeNet5
...@@ -83,7 +83,7 @@ TAG = 'Lenet5_train' ...@@ -83,7 +83,7 @@ TAG = 'Lenet5_train'
### Configuring Parameters ### Configuring Parameters
1. Set the running environment, dataset path, model training parameters, checkpoint storage parameters, and differential privacy parameters. Replace 'data_path' with you data path. 1. Set the running environment, dataset path, model training parameters, checkpoint storage parameters, and differential privacy parameters. Replace 'data_path' with you data path. For more configurations, see <https://gitee.com/mindspore/mindarmour/blob/master/example/mnist_demo/lenet5_dp.py>.
```python ```python
cfg = edict({ cfg = edict({
...@@ -99,9 +99,9 @@ TAG = 'Lenet5_train' ...@@ -99,9 +99,9 @@ TAG = 'Lenet5_train'
'device_target': 'Ascend', # device used 'device_target': 'Ascend', # device used
'data_path': './MNIST_unzip', # the path of training and testing data set 'data_path': './MNIST_unzip', # the path of training and testing data set
'dataset_sink_mode': False, # whether deliver all training data to device one time 'dataset_sink_mode': False, # whether deliver all training data to device one time
'micro_batches': 16, # the number of small batches split from an original batch 'micro_batches': 32, # the number of small batches split from an original batch
'norm_bound': 1.0, # the clip bound of the gradients of model's training parameters 'norm_bound': 1.0, # the clip bound of the gradients of model's training parameters
'initial_noise_multiplier': 1.0, # the initial multiplication coefficient of the noise added to training 'initial_noise_multiplier': 0.05, # the initial multiplication coefficient of the noise added to training
# parameters' gradients # parameters' gradients
'noise_mechanisms': 'Gaussian', # the method of adding noise in gradients while training 'noise_mechanisms': 'Gaussian', # the method of adding noise in gradients while training
'clip_mechanisms': 'Gaussian', # the method of adaptive clipping gradients while training 'clip_mechanisms': 'Gaussian', # the method of adaptive clipping gradients while training
......
...@@ -55,7 +55,7 @@ from mindspore.dataset.transforms.vision import Inter ...@@ -55,7 +55,7 @@ from mindspore.dataset.transforms.vision import Inter
import mindspore.common.dtype as mstype import mindspore.common.dtype as mstype
from mindarmour.diff_privacy import DPModel from mindarmour.diff_privacy import DPModel
from mindarmour.diff_privacy import NoiseMechanismsFacotry from mindarmour.diff_privacy import NoiseMechanismsFactory
from mindarmour.diff_privacy import ClipMechanismsFactory from mindarmour.diff_privacy import ClipMechanismsFactory
from mindarmour.diff_privacy import PrivacyMonitorFactory from mindarmour.diff_privacy import PrivacyMonitorFactory
from mindarmour.utils.logger import LogUtil from mindarmour.utils.logger import LogUtil
...@@ -69,7 +69,7 @@ TAG = 'Lenet5_train' ...@@ -69,7 +69,7 @@ TAG = 'Lenet5_train'
### 参数配置 ### 参数配置
1. 设置运行环境、数据集路径、模型训练参数、checkpoint存储参数、差分隐私参数,`data_path`数据路径替换成你的数据集所在路径。 1. 设置运行环境、数据集路径、模型训练参数、checkpoint存储参数、差分隐私参数,`data_path`数据路径替换成你的数据集所在路径。更多配置可以参考<https://gitee.com/mindspore/mindarmour/blob/master/example/mnist_demo/lenet5_config.py>
```python ```python
cfg = edict({ cfg = edict({
...@@ -85,9 +85,9 @@ TAG = 'Lenet5_train' ...@@ -85,9 +85,9 @@ TAG = 'Lenet5_train'
'device_target': 'Ascend', # device used 'device_target': 'Ascend', # device used
'data_path': './MNIST_unzip', # the path of training and testing data set 'data_path': './MNIST_unzip', # the path of training and testing data set
'dataset_sink_mode': False, # whether deliver all training data to device one time 'dataset_sink_mode': False, # whether deliver all training data to device one time
'micro_batches': 16, # the number of small batches split from an original batch 'micro_batches': 32, # the number of small batches split from an original batch
'norm_bound': 1.0, # the clip bound of the gradients of model's training parameters 'norm_bound': 1.0, # the clip bound of the gradients of model's training parameters
'initial_noise_multiplier': 1.0, # the initial multiplication coefficient of the noise added to training 'initial_noise_multiplier': 0.05, # the initial multiplication coefficient of the noise added to training
# parameters' gradients # parameters' gradients
'noise_mechanisms': 'Gaussian', # the method of adding noise in gradients while training 'noise_mechanisms': 'Gaussian', # the method of adding noise in gradients while training
'clip_mechanisms': 'Gaussian', # the method of adaptive clipping gradients while training 'clip_mechanisms': 'Gaussian', # the method of adaptive clipping gradients while training
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册