ServerConfig#
- class fl_sim.nodes.ServerConfig(*args: ~typing.Any, num_iters: int, num_clients: int | None = None, clients_sample_ratio: float, log_dir: str | ~pathlib.Path | None = None, txt_logger: bool = True, json_logger: bool = True, eval_every: int = 1, visiable_gpus: ~typing.List[int] | None = None, extra_observes: ~typing.List[str] = <factory>, seed: int = 0, tag: str | None = None, verbose: int = 1, gpu_proportion: float = 0.2, algorithm: str = '', **kwargs: ~typing.Any)[源代码]#
基类:
BaseModelConfigs for the Server.
- 参数:
algorithm (str) -- The algorithm name. Defaults to be derived from the class name (with the
ServerConfigsuffix removed).num_iters (int) -- The number of (outer) iterations.
num_clients (int, optional) -- The number of clients. If None, will use the dataset's default (filled in by
Server._post_init()).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.
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][源代码]#
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].