1 Star 0 Fork 1

xxxianyu/federated-continual-learning

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.py 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
wyjeong 提交于 2020-04-27 19:48 . FedAPC
##################################
# Main Process
# : initiate Server application that
# initialize multiple clients threads
# and model hyper-parameters
##################################
__author__ = "Wonyong Jeong"
__credits__ = ["Wonyong Jeong"]
__email__ = "wyjeong@kaist.ac.kr"
##################################
import os
from datetime import datetime
from parser import Parser
from utils.data import *
def main(opt):
os.environ['CUDA_VISIBLE_DEVICES']=opt.gpu
opt = set_options(opt)
if opt.model == 'fed-apc':
from models.fed_apc.server import Server
server = Server(opt)
server.run()
else:
print('incorrect model was given: {}'.format(opt.model))
os._exit(0)
def set_options(opt):
now = datetime.now().strftime("%Y%m%d-%H%M")
opt.log_dir = 'outputs/logs/{}'.format(now)
if len(opt.exp_mark)>0:
opt.log_dir += '-{}'.format(opt.exp_mark)
if not os.path.isdir(opt.log_dir):
os.makedirs(opt.log_dir)
# adaptive learning rate
opt.lr_patience = 3
opt.lr_factor = 3
opt.lr_min = 1e-8
# base network hyperparams
if opt.base_network == 'alexnet-like':
opt.lr = 1e-4
opt.wd = 1e-2
opt.momentum = 0.9
if 'fed-apc' in opt.model:
opt.wd = 1e-4
opt.lambda_l1 = 1e-3
opt.lambda_l2 = 100.
opt.lambda_mask = 0
# task pool options
opt = set_task_pool(opt)
return opt
if __name__ == '__main__':
main(Parser().parse())
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xxxianyu/federated-continual-learning.git
git@gitee.com:xxxianyu/federated-continual-learning.git
xxxianyu
federated-continual-learning
federated-continual-learning
master

搜索帮助