p2pfl.learning.frameworks.callback_factory moduleΒΆ

P2PFLCallback factory.

class p2pfl.learning.frameworks.callback_factory.CallbackFactory[source]ΒΆ

Bases: object

Factory for creating callbacks based on learner framework and aggregator requirements.

classmethod create_callbacks(framework, aggregator)[source]ΒΆ

Create the callbacks required by the aggregator for the given learner.

Parameters:
  • framework (str) – The framework of the learner.

  • aggregator (Any) – The aggregator instance.

Return type:

List[P2PFLCallback]

classmethod register_callback(learner, callback)[source]ΒΆ

Register a callback constructor for a given learner framework and callback key.

Parameters:
  • learner (str) – The learner instance (e.g., β€˜KerasLearner’, β€˜LightningLearner’).

  • callback (Type[P2PFLCallback]) – A callback.