nvflare.app_opt.pt.scaffold module

class PTScaffoldHelper[source]

Bases: object

Helper to be used with SCAFFOLD components. Implements the functions used for the algorithm proposed in Karimireddy et al. “SCAFFOLD: Stochastic Controlled Averaging for Federated Learning” (https://arxiv.org/abs/1910.06378) using PyTorch. SCAFFOLD-related functions are based on https://github.com/Xtra-Computing/NIID-Bench. See also Li et al. “Federated Learning on Non-IID Data Silos: An Experimental Study” (https://arxiv.org/abs/2102.02079).

get_delta_controls()[source]
get_params()[source]
init(model)[source]
load_global_controls(weights)[source]
model_update(model, curr_lr, c_global_para, c_local_para)[source]
terms_update(model, curr_lr, c_global_para, c_local_para, model_global)[source]
get_lr_values(optimizer: Optimizer)[source]

This function is used to get the learning rates of the optimizer.