classBaseFLTask(BaseModel,ABC):model_config=ConfigDict(arbitrary_types_allowed=True)@property@abstractmethoddeftraining_loop(self)->Callable:...@classmethod@abstractmethoddeffrom_configs(cls,trainer_cfg:BaseFLTaskConfig,tester_cfg:Any)->Self:...@classmethod@abstractmethoddeffrom_trainer_and_tester(cls,trainer:Callable,tester:Callable)->Self:try:trainer_cfg=getattr(trainer,"__fl_task_trainer_config")exceptAttributeError:msg=("`__fl_task_trainer_config` has not been set on training loop. Make ""sure to decorate your training loop with the appropriate ""decorator.")raiseMissingFLTaskConfig(msg)try:tester_cfg=getattr(tester,"__fl_task_tester_config")exceptAttributeError:msg=("`__fl_task_tester_config` has not been set on tester callable. Make ""sure to decorate your tester with the appropriate decorator.")raiseMissingFLTaskConfig(msg)returncls.from_configs(trainer_cfg,tester_cfg)@abstractmethoddefsimulate(self,num_clients:int,**kwargs:Any)->Any:"""Simulate the FL task. Either use flwr's simulation tools, or create our own here. """...@abstractmethoddefserver(self,**kwargs:Any)->Server:"""Create a flwr.Server object."""...@abstractmethoddefclient(self,**kwargs:Any)->Client:"""Create a flwr.Client object."""...
@abstractmethoddefsimulate(self,num_clients:int,**kwargs:Any)->Any:"""Simulate the FL task. Either use flwr's simulation tools, or create our own here. """...