fix some expression errors

This commit is contained in:
yangxixin 2022-07-08 16:38:00 +08:00
parent bdbe8a5340
commit f42b7dbf14
3 changed files with 28 additions and 27 deletions

View File

@ -7,7 +7,7 @@
**参数:**
- **model** (nn.Cell) - 一个用于联邦训练的模型。
- **model** (nn.Cell) - 用于联邦训练的模型。
- **sync_frequency** (int) - 联邦学习中的参数同步频率。
需要注意在数据下沉模式中频率的单位是epoch的数量。否则频率的单位是step的数量。
在自适应同步频率模式下为初始同步频率,在固定频率模式下为同步频率。
@ -20,8 +20,7 @@
取值范围大于等于0.0。默认值1.1。
- **min_consistent_rate_at_round** (int) - 最小一致性比率阈值的轮数,该值越大同步频率提升难度越大。
取值范围大于等于0。默认值0。
- **ema_alpha** (float) - 梯度一致性平滑系数,该值越小越会根据当前轮次的梯度分叉情况来判断频率是否
需要改变,反之则会更加根据历史梯度分叉情况来判断。
- **ema_alpha** (float) - 梯度一致性平滑系数,该值越小越会根据当前轮次的梯度分叉情况来判断频率是否需要改变,反之则会更加根据历史梯度分叉情况来判断。
取值范围:(0.0, 1.0)。默认值0.5。
- **observation_window_size** (int) - 观察时间窗的轮数,该值越大同步频率减小难度越大。
取值范围大于0。默认值5。
@ -39,4 +38,4 @@
**参数:**
- **run_context** (RunContext) - 包含模型的相关信息。
- **run_context** (RunContext) - 包含模型的相关信息。

View File

@ -8,7 +8,7 @@ Federated-Server
.. note::
设置属性时,必须输入属性名称。
某些配置需要在特定角色上设置,有关详细信息,请参见下表:
在特定角色需要设置不同配置,详细信息参见下表:
+-------------------------+---------------------------------+-----------------------------+
| 功能分类 | 配置参数 | 联邦学习角色 |
@ -127,13 +127,12 @@ Federated-Server
- **client_batch_size** (int) - 客户端训练数据batch数。默认值32。
- **client_learning_rate** (float) - 客户端训练学习率。默认值0.001。
- **worker_step_num_per_iteration** (int) - 端云联邦中云侧训练进程在与服务器通信之前的独立训练步数。默认值65。
- **encrypt_type** (str) - 用于联邦学习的安全策略,可以是'NOT_ENCRYPT'、'DP_ENCRYPT'、
'PW_ENCRYPT'、'STABLE_PW_ENCRYPT'或'SIGNDS'。如果是'DP_ENCRYPT',则将对客户端应用差分隐私模式,
隐私保护效果将由上面所述的dp_eps、dp_delta、dp_norm_clip确定。如果'PW_ENCRYPT'则将应用成对pairwisePW安全聚合
来保护客户端模型在跨设备场景中不被窃取。如果'STABLE_PW_ENCRYPT',则将应用成对安全聚合来保护客户端模型在云云联邦场景中
免受窃取。如果'SIGNDS'则将在于客户端上使用SignDS策略。SignDS的介绍可以参照
`SignDS-FL: Local Differentially Private Federated Learning with Sign-based Dimension Selection <https://dl.acm.org/doi/abs/10.1145/3517820>`_
默认值:'NOT_ENCRYPT'。
- **encrypt_type** (str) - 用于联邦学习的安全策略,支持['NOT_ENCRYPT'、'DP_ENCRYPT'、'PW_ENCRYPT'、'STABLE_PW_ENCRYPT', 'SIGNDS']。 默认值:'NOT_ENCRYPT'。
如果是'DP_ENCRYPT'则将对客户端应用差分隐私模式隐私保护效果将由dp_eps、dp_delta、dp_norm_clip确定
如果是'PW_ENCRYPT'则将应用成对pairwisePW安全聚合来保护客户端模型在跨设备场景中不被窃取
如果是'STABLE_PW_ENCRYPT',则将应用成对安全聚合来保护客户端模型在云云联邦场景中免受窃取;
如果是'SIGNDS'则将在于客户端上使用SignDS策略。
SignDS的介绍可以参照`SignDS-FL: Local Differentially Private Federated Learning with Sign-based Dimension Selection <https://dl.acm.org/doi/abs/10.1145/3517820>`_
- **share_secrets_ratio** (float) - PW参与秘密分享的客户端比例。默认值1.0。
- **cipher_time_window** (int) - PW每个加密轮次的时间窗口持续时间以毫秒为单位。默认值300000。
- **reconstruct_secrets_threshold** (int) - PW秘密重建的阈值。默认值2000。
@ -145,18 +144,18 @@ Federated-Server
- **sign_thr_ratio** (float) - SignDS预期Top-k维度的阈值。建议取值范围在[0.5, 1]内。默认值0.6。
- **sign_global_lr** (float) - SignDS分配给选定维的常量值。适度增大该值会提高收敛速度但有可能让模型梯度爆炸。取值必须大于0。默认值1。
- **sign_dim_out** (int) - SignDS输出维度的数量。建议取值范围在[0, 50]内。默认值0。
- **config_file_path** (str) - 用于集群容灾恢复的配置文件路径、认证相关参数以及文件路径、评价指标文件路径和运维相关文件路径。默认值:""
- **config_file_path** (str) - 用于集群容灾恢复的配置文件路径、认证相关参数以及文件路径、评价指标文件路径和运维相关文件路径。默认值:''
- **scheduler_manage_port** (int) - 用于扩容/缩容的调度器管理端口。默认值11202。
- **enable_ssl** (bool) - 设置联邦学习开启SSL安全通信。默认值False。
- **client_password** (str) - 解密客户端证书中存储的秘钥的密码。默认值:""
- **server_password** (str) - 解密服务器证书中存储的秘钥的密码。默认值:""
- **client_password** (str) - 解密客户端证书中存储的秘钥的密码。默认值:''
- **server_password** (str) - 解密服务器证书中存储的秘钥的密码。默认值:''
- **pki_verify** (bool) - 如果为True则将打开服务器和客户端之间的身份验证。
还应从https://pki.consumer.huawei.com/ca/下载Root CA证书、Root CA G2证书和移动设备CRL证书。
还应从`CBG PKI Download Management <https://pki.consumer.huawei.com/ca/>`_ 下载Root CA证书、Root CA G2证书和移动设备CRL证书。
需要注意的是只有当客户端是具有HUKS服务的Android环境时pki_verify可以为True。默认值False。
- **root_first_ca_path** (str) - Root CA证书的文件路径。当pki_verify为True时需要设置该值。默认值""。
- **root_second_ca_path** (str) - Root CA G2证书的文件路径。当pki_verify为True时需要设置该值。默认值""。
- **equip_crl_path** (str) - 移动设备CRL证书的文件路径。当pki_verify为True时需要设置该值。默认值""。
- **replay_attack_time_diff** (int) - 证书时间戳验证的最大可容忍错误毫秒。默认值600000。
- **replay_attack_time_diff** (int) - 证书时间戳验证的最大可容忍错误时间毫秒。默认值600000。
- **http_url_prefix** (str) - 设置联邦学习端云通信的http路径。默认值""。
- **global_iteration_time_window** (int) - 一次迭代的全局时间窗口轮次ms。默认值3600000。
- **checkpoint_dir** (str) - server读取和保存模型文件的目录。若没有设置则不读取和保存模型文件。默认值""。
@ -182,9 +181,8 @@ Federated-Server
**返回:**
根据key返回属性值。
Object表示给定属性key的值。
**异常:**
- **ValueError** - 如果输入key不是联邦学习模式context中的属性。

View File

@ -1179,14 +1179,18 @@ def set_fl_context(**kwargs):
client_learning_rate (float): Client training learning rate. Default: 0.001.
worker_step_num_per_iteration (int): The worker's standalone training step number before communicating with
server. Default: 65.
encrypt_type (str): Secure schema for federated learning, which can be 'NOT_ENCRYPT', 'DP_ENCRYPT',
'PW_ENCRYPT', 'STABLE_PW_ENCRYPT' or 'SIGNDS'. If 'DP_ENCRYPT', differential privacy schema would be applied
for clients and the privacy protection effect would be determined by dp_eps, dp_delta and dp_norm_clip
as described above. If 'PW_ENCRYPT', pairwise secure aggregation would be applied to protect clients'
model from stealing in cross-device scenario. If 'STABLE_PW_ENCRYPT', pairwise secure aggregation would
be applied to protect clients' model from stealing in cross-silo scenario. If 'SIGNDS', SignDS schema would
be applied for clients. Default: 'NOT_ENCRYPT'.
share_secrets_ratio (float): The ratio for computing the threshold count of share secrets. Default: 1.0.
encrypt_type (str): Secure schema for federated learning, the value must be in ['NOT_ENCRYPT',
'DP_ENCRYPT', 'PW_ENCRYPT', 'STABLE_PW_ENCRYPT', 'SIGNDS'].
Default: 'NOT_ENCRYPT'.
If 'DP_ENCRYPT', differential privacy schema would be applied for clients and
the privacy protection effect would be determined by dp_eps, dp_delta and
dp_norm_clip as described above.
If 'PW_ENCRYPT', pairwise secure aggregation would be applied to protect
clients' model from stealing in cross-device scenario.
If 'STABLE_PW_ENCRYPT', pairwise secure aggregation would be applied to protect
clients' model from stealing in cross-silo scenario.
If 'SIGNDS', SignDS schema would be applied for clients.
share_secrets_ratio (float): The percentage of clients sharing secrets. Default: 1.0.
cipher_time_window (int): The time window duration for each cipher round in millisecond. Default: 300000.
reconstruct_secrets_threshold (int): The threshold count of reconstruct threshold. Default: 2000.
dp_eps (float): Epsilon budget of differential privacy mechanism. The smaller the dp_eps, the better the