ServerConfig#

class fl_sim.nodes.ServerConfig(algorithm: str, num_iters: int, num_clients: int, clients_sample_ratio: float, log_dir: Path | str | None = None, txt_logger: bool = True, json_logger: bool = True, eval_every: int = 1, visiable_gpus: Sequence[int] | None = None, extra_observes: List[str] | None = None, seed: int = 0, tag: str | None = None, verbose: int = 1, gpu_proportion: float = 0.2, **kwargs: Any)[source]#

Bases: ReprMixin

Configs for the Server.

Parameters:
  • algorithm (str) – The algorithm name.

  • num_iters (int) – The number of (outer) iterations.

  • num_clients (int) – The number of clients.

  • clients_sample_ratio (float) – The ratio of clients to sample for each iteration.

  • log_dir (str or pathlib.Path, optional) – The log directory. If not specified, will use the default log directory. If not absolute, will be relative to the default log directory.

  • txt_logger (bool, default True) – Whether to use txt logger.

  • json_logger (bool, default True) – Whether to use json logger.

  • eval_every (int, default 1) – The number of iterations to evaluate the model.

  • visiable_gpus (Sequence[int], optional) – Visable GPU IDs for allocating devices for clients. Defaults to use all GPUs if available.

  • extra_observes (List[str], optional) – Extra attributes to observe during training.

  • seed (int, default 0) – The random seed.

  • tag (str, optional) – The tag of the experiment.

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

  • gpu_proportion (float, default 0.2) – The proportion of clients to use GPU. Used to similate the system heterogeneity of the clients. Not used in the current version, reserved for future use.

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

extra_repr_keys() List[str][source]#

Extra keys for __repr__() and __str__().