nvflare.app_opt.he.model_encryptor module
- class HEModelEncryptor(tenseal_context_file: str = 'client_context.tenseal', encrypt_layers: list[str] | str | None = None, aggregation_weights: dict[str, float] | None = None, weigh_by_local_iter: bool = True, data_kinds: list[DataKind] | None = None)[source]
Bases:
DXOFilter- Filter to encrypt Shareable object using homomorphic encryption (HE) with TenSEAL
- Parameters:
tenseal_context_file – tenseal context files containing encryption keys and parameters
encrypt_layers – if not specified (None), all layers are being encrypted; if list of variable/layer names, only specified variables are encrypted; if string containing regular expression (e.g. “conv”), only matched variables are being encrypted.
aggregation_weights – dictionary of client aggregation {“client1”: 1.0, “client2”: 2.0, “client3”: 3.0}; defaults to a weight of 1.0 if not specified. Note, if specified, the same aggregation_weights should also be used on the server aggregator for the resulting weighted sum to be valid, i.e. in HEInTimeAccumulateWeightedAggregator.
weigh_by_local_iter – If true, multiply client weights on first before encryption (default: True
HE) (which is recommended for)
data_kinds – data kinds to apply this filter