nvflare.app_opt.he.model_shareable_generator module¶
- class HEModelShareableGenerator(tenseal_context_file='server_context.tenseal')[source]¶
Bases:
ShareableGenerator
This ShareableGenerator converts between Shareable and Learnable objects.
This conversion is done with homomorphic encryption (HE) support using TenSEAL https://github.com/OpenMined/TenSEAL.
- Parameters:
tenseal_context_file – tenseal context files containing TenSEAL context
- handle_event(event_type: str, fl_ctx: FLContext)[source]¶
Handles events.
- Parameters:
event_type (str) – event type fired by workflow.
fl_ctx (FLContext) – FLContext information.
- learnable_to_shareable(model_learnable: ModelLearnable, fl_ctx: FLContext) → Shareable[source]¶
Convert ModelLearnable to Shareable.
- Parameters:
model_learnable (ModelLearnable) – model to be converted
fl_ctx (FLContext) – FL context
- Returns:
a shareable containing a DXO object.
- Return type:
Shareable
- shareable_to_learnable(shareable: Shareable, fl_ctx: FLContext) → ModelLearnable[source]¶
Updates the global model in Learnable in encrypted space.
- Parameters:
shareable – shareable
fl_ctx – FLContext
- Returns:
Learnable object