加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
config.py 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
electronick_pro 提交于 2023-06-15 20:34 . wyn0615
import json
def get_dyna_config():
with open("dynamic_config.json", "r") as fi:
ret = json.load(fi)
return ret
def set_dyna_config(conf):
with open("dynamic_config.json", "w") as fo:
fo.write(json.dumps(conf))
key = bytes(range(16))
init_model_path = "init_model.pt"
client_final_model_path = "client_final_model.pt"
single_final_model_path = "single_final_model.pt"
server_addr_path = "clientips"
server_weight_path = "AggregationWeight"
def coor_addr_path(serverip): return f"clientips/{serverip}"
# There is expected to be a meta file which instructs the path of each param
# Each file is named by model.state_dict().keys()
client_param_dir = "param"
client_param_tar_path = "param.tar"
client_mask_dir = "mask"
client_mask_tar_path = "mask.tar"
def coor_mask_dir(clientip): return f"mask/{clientip}"
def coor_mask_tar_path(clientip): return f"mask/{clientip}.tar"
def server_param_dir(ip): return f"param/{ip}"
def server_param_tar_path(ip): return f"param/{ip}.tar"
server_aggregated_param_dir = "param0"
server_aggregated_param_tar_path = "param0.tar"
def coor_aggregated_mask_dir(serverip): return f"mask{serverip}"
def coor_aggregated_mask_tar_path(serverip): return f"mask{serverip}.tar"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化