-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle list fo configs in json config adpator
Summary: Currently, flsim cannot handle a list of configs Eg: a json config like the following is not supported. ``` { "trainer": { "clients": [ {"_base_": "base_client", "optimizer": {"lr": 0.1}}, {"_base_": "base_client", "optimizer": {"lr": 0.2}}, ] } ``` The one hiccup in supporting this is hydra still doesn't support overriding/appending lists when values are configs. (see facebookresearch/hydra#1939 (comment)) In order to overcome the above, we treat the list as a dictionary with the key as list index. The above config in yaml format will look as follows: ``` trainer: ... clients: '0': _target_: flsim.clients.base_client.Client _recursive_: false epochs: 1 optimizer: _target_: ??? _recursive_: false lr: 0.1 momentum: 0.0 weight_decay: 0.0 lr_scheduler: _target_: ??? _recursive_: false base_lr: 0.001 max_clip_norm_normalized: null only_federated_params: true random_seed: null shuffle_batch_order: false store_models_and_optimizers: false track_multiple_selection: false '1': _target_: flsim.clients.base_client.Client _recursive_: false epochs: 1 optimizer: _target_: ??? _recursive_: false lr: 0.1 momentum: 0.0 weight_decay: 0.0 lr_scheduler: _target_: ??? _recursive_: false base_lr: 0.001 max_clip_norm_normalized: null only_federated_params: true random_seed: null shuffle_batch_order: false store_models_and_optimizers: false track_multiple_selection: false ... ``` Reviewed By: Anonymani Differential Revision: D37638999 fbshipit-source-id: 5444da742742d4cc976875a6dc055a0c71c186e4
- Loading branch information
1 parent
bae5e65
commit fb884b3
Showing
2 changed files
with
99 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters