ClientConfig#

class fl_sim.nodes.ClientConfig(*args: ~typing.Any, batch_size: int, num_epochs: int, lr: float, optimizer: str, scheduler: dict | None = None, extra_observes: ~typing.List[str] = <factory>, verbose: int = 1, latency: float = 0.0, algorithm: str = '', **kwargs: ~typing.Any)[source]#

Bases: BaseModel

Configs for the Client.

Parameters:
  • algorithm (str) – The algorithm name. Defaults to be derived from the class name (with the ClientConfig suffix removed).

  • optimizer (str) – The name of the optimizer to solve the local (inner) problem.

  • batch_size (int) – The batch size.

  • num_epochs (int) – The number of epochs.

  • lr (float) – The learning rate.

  • scheduler (dict, optional) – The scheduler config. None for no scheduler, using constant learning rate.

  • extra_observes (List[str], optional) – Extra attributes to observe during training, which would be recorded in evaluated metrics, sent to the server, and written to the log file.

  • verbose (int, default 1) – The verbosity level.

  • latency (float, default 0.0) – The latency of the client. Not used in the current version, reserved for future use.

  • **kwargs (dict, optional) – The other arguments, will be set as attributes of the class.

  • note:: (..) – Positional arguments are supported for backward compatibility (mapped onto the fields in their declaration order), but keyword arguments are recommended.

extra_repr_keys() → List[str][source]#

Kept for backward compatibility with the former ReprMixin-based configs; the fields are all included in the (pydantic) default representation.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].