diff --git a/README.md b/README.md index ea7d8b0c7..b4add8087 100644 --- a/README.md +++ b/README.md @@ -127,9 +127,9 @@ Here we demonstrate how to run a standard FL task with FederatedScope, with sett ```bash # Run with default configurations -python federatedscope/main.py --cfg federatedscope/example_configs/femnist.yaml +python federatedscope/main.py --cfg scripts/example_configs/femnist.yaml # Or with custom configurations -python federatedscope/main.py --cfg federatedscope/example_configs/femnist.yaml federated.total_round_num 50 data.batch_size 128 +python federatedscope/main.py --cfg scripts/example_configs/femnist.yaml federated.total_round_num 50 data.batch_size 128 ``` Then you can observe some monitored metrics during the training process as: @@ -169,12 +169,12 @@ We prepare a synthetic example for running with distributed mode: ```bash # For server -python main.py --cfg federatedscope/example_configs/distributed_server.yaml distribute.data_file 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_server.yaml distribute.data_file 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx # For clients -python main.py --cfg federatedscope/example_configs/distributed_client_1.yaml distribute.data_file 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx distribute.client_host x.x.x.x distribute.client_port xxxx -python main.py --cfg federatedscope/example_configs/distributed_client_2.yaml distribute.data_file 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx distribute.client_host x.x.x.x distribute.client_port xxxx -python main.py --cfg federatedscope/example_configs/distributed_client_3.yaml distribute.data_file 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx distribute.client_host x.x.x.x distribute.client_port xxxx +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_client_1.yaml distribute.data_file 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx distribute.client_host x.x.x.x distribute.client_port xxxx +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_client_2.yaml distribute.data_file 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx distribute.client_host x.x.x.x distribute.client_port xxxx +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_client_3.yaml distribute.data_file 'PATH/TO/DATA' distribute.server_host x.x.x.x distribute.server_port xxxx distribute.client_host x.x.x.x distribute.client_port xxxx ``` An executable example with generated toy data can be run with (a script can be found in `scripts/run_distributed_lr.sh`): @@ -183,14 +183,14 @@ An executable example with generated toy data can be run with (a script can be f python scripts/gen_data.py # Firstly start the server that is waiting for clients to join in -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_server.yaml distribute.data_file toy_data/server_data distribute.server_host 127.0.0.1 distribute.server_port 50051 +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_server.yaml distribute.data_file toy_data/server_data distribute.server_host 127.0.0.1 distribute.server_port 50051 # Start the client #1 (with another process) -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_client_1.yaml distribute.data_file toy_data/client_1_data distribute.server_host 127.0.0.1 distribute.server_port 50051 distribute.client_host 127.0.0.1 distribute.client_port 50052 +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_client_1.yaml distribute.data_file toy_data/client_1_data distribute.server_host 127.0.0.1 distribute.server_port 50051 distribute.client_host 127.0.0.1 distribute.client_port 50052 # Start the client #2 (with another process) -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_client_2.yaml distribute.data_file toy_data/client_2_data distribute.server_host 127.0.0.1 distribute.server_port 50051 distribute.client_host 127.0.0.1 distribute.client_port 50053 +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_client_2.yaml distribute.data_file toy_data/client_2_data distribute.server_host 127.0.0.1 distribute.server_port 50051 distribute.client_host 127.0.0.1 distribute.client_port 50053 # Start the client #3 (with another process) -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_client_3.yaml distribute.data_file toy_data/client_3_data distribute.server_host 127.0.0.1 distribute.server_port 50051 distribute.client_host 127.0.0.1 distribute.client_port 50054 +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_client_3.yaml distribute.data_file toy_data/client_3_data distribute.server_host 127.0.0.1 distribute.server_port 50051 distribute.client_host 127.0.0.1 distribute.client_port 50054 ``` And you can observe the results as (the IP addresses are anonymized with 'x.x.x.x'): diff --git a/demo/bbo.py b/demo/bbo.py index 286c1d361..5b9c2236f 100644 --- a/demo/bbo.py +++ b/demo/bbo.py @@ -23,8 +23,7 @@ def eval_fl_algo(x): from federatedscope.core.fed_runner import FedRunner init_cfg = global_cfg.clone() - init_cfg.merge_from_file( - "federatedscope/example_configs/single_process.yaml") + init_cfg.merge_from_file("scripts/example_configs/single_process.yaml") init_cfg.merge_from_list(["train.optimizer.lr", float(x[0])]) update_logger(init_cfg, True) diff --git a/demo/hpbandster/rs.py b/demo/hpbandster/rs.py index 1cfbb967e..bb990bf01 100644 --- a/demo/hpbandster/rs.py +++ b/demo/hpbandster/rs.py @@ -43,8 +43,7 @@ def eval_fl_algo(x, b): from federatedscope.core.fed_runner import FedRunner init_cfg = global_cfg.clone() - init_cfg.merge_from_file( - "federatedscope/example_configs/single_process.yaml") + init_cfg.merge_from_file("scripts/example_configs/single_process.yaml") # specify the configuration of interest init_cfg.merge_from_list([ "train.optimizer.lr", diff --git a/demo/smac/gp.py b/demo/smac/gp.py index a0a72e2ad..628863c6f 100644 --- a/demo/smac/gp.py +++ b/demo/smac/gp.py @@ -19,8 +19,7 @@ def eval_fl_algo(x): from federatedscope.core.fed_runner import FedRunner init_cfg = global_cfg.clone() - init_cfg.merge_from_file( - "federatedscope/example_configs/single_process.yaml") + init_cfg.merge_from_file("scripts/example_configs/single_process.yaml") # specify the configuration of interest init_cfg.merge_from_list([ "optimizer.lr", diff --git a/demo/smac/rf.py b/demo/smac/rf.py index 05478e5ba..6e2c1cd86 100644 --- a/demo/smac/rf.py +++ b/demo/smac/rf.py @@ -19,8 +19,7 @@ def eval_fl_algo(x): from federatedscope.core.fed_runner import FedRunner init_cfg = global_cfg.clone() - init_cfg.merge_from_file( - "federatedscope/example_configs/single_process.yaml") + init_cfg.merge_from_file("scripts/example_configs/single_process.yaml") # specify the configuration of interest init_cfg.merge_from_list([ "optimizer.lr", diff --git a/federatedscope/example_configs/cora/run.sh b/federatedscope/example_configs/cora/run.sh deleted file mode 100644 index fcb735f6d..000000000 --- a/federatedscope/example_configs/cora/run.sh +++ /dev/null @@ -1,8 +0,0 @@ -# SHA -python hpo.py --cfg federatedscope/example_configs/cora/sha.yaml - -# SHA wrap FedEX (FedEX related param) -python hpo.py --cfg federatedscope/example_configs/cora/sha_wrap_fedex.yaml - -# SHA wrap FedEX (arm) -python hpo.py --cfg federatedscope/example_configs/cora/sha_wrap_fedex_arm.yaml \ No newline at end of file diff --git a/federatedscope/example_configs/femnist/run.sh b/federatedscope/example_configs/femnist/run.sh deleted file mode 100644 index aaa695886..000000000 --- a/federatedscope/example_configs/femnist/run.sh +++ /dev/null @@ -1,8 +0,0 @@ -# SHA -python hpo.py --cfg federatedscope/example_configs/femnist/sha.yaml - -# SHA wrap FedEX (FedEX related param) -python hpo.py --cfg federatedscope/example_configs/femnist/sha_wrap_fedex.yaml - -# SHA wrap FedEX (arm) -python hpo.py --cfg federatedscope/example_configs/femnist/sha_wrap_fedex_arm.yaml \ No newline at end of file diff --git a/federatedscope/organizer/client.py b/federatedscope/organizer/client.py index 9db866b0b..e8568aabb 100644 --- a/federatedscope/organizer/client.py +++ b/federatedscope/organizer/client.py @@ -156,7 +156,7 @@ def do_create_room(self, line): ' command, extra command to launch FS\n' \ ' psw, password for room \n\n' \ 'Example:\n' \ - ' create_room --cfg ../../federatedscope/example_configs' \ + ' create_room --cfg ../../scripts/example_configs' \ '/distributed_femnist_server.yaml 12345\n' try: global organizer diff --git a/run_reorganized_standalone.sh b/run_reorganized_standalone.sh index 595fdc43c..0ecea9fa4 100755 --- a/run_reorganized_standalone.sh +++ b/run_reorganized_standalone.sh @@ -10,7 +10,7 @@ echo "Starts..." lr=0.01 -python federatedscope/main.py --cfg federatedscope/example_configs/single_process.yaml device ${cudaid} data.type toy data.splitter ooxx \ +python federatedscope/main.py --cfg scripts/example_configs/single_process.yaml device ${cudaid} data.type toy data.splitter ooxx \ optimizer.lr ${lr} model.type lr federate.mode standalone trainer.type general federate.total_round_num 50 \ >>out_reorganize/lr.out \ 2>>out_reorganize/lr.err diff --git a/scripts/README.md b/scripts/README.md index 97b808b64..12d47bf9c 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -6,37 +6,43 @@ General: - [Distribute Mode](#distribute-mode) ### Distribute Mode -Users can train an LR on generated toy data with distribute mode via (`pwd=FederatedScope/`): +Users can train an LR on generated toy data with distribute mode via: ```shell script -bash scripts/run_distributed_lr.sh +bash distributed_scripts/run_distributed_lr.sh ``` The FL course consists of 1 server and 3 clients, which executes on one device as simulation. Each client owns private data and the server holds a test set for global evaluation. - For running with multiple devices, you need to specify the host/port of IP addresses in the configurations (i.e., the yaml files) and make sure these devices are connected. Then you can launch the participants (i.e., `python federatedscope/main.py --cfg xxx.yaml`) on each provided device (Remember to launch the server first). -- For the situation that server doesn't own data and the evaluation is performed at clients, use `distributed_server_no_data.yaml` at this [line](https://github.com/alibaba/FederatedScope/blob/master/scripts/run_distributed_lr.sh#L11). +- For the situation that server doesn't own data and the evaluation is performed at clients, use `distributed_server_no_data.yaml` at this [line](https://github.com/alibaba/FederatedScope/blob/master/scripts/distributed_scripts/run_distributed_lr.sh#L11). Also, users can run distribute mode with other provided datasets and models. Take training ConvNet on FEMNIST as an example: ```shell script -bash scripts/run_distributed_conv_femnist.sh +bash distributed_scripts/run_distributed_conv_femnist.sh ``` ### Federated Learning in Computer Vision (FL-CV) We provide several configurations (yaml files) as examples to demonstrate how to apply FL in CV with FederatedScope. Users can run the following comments for reproducing, and modify/add the yaml file for customization, such as using provided/customized datasets and models, tunning hyperparameters, etc. -Train convent-2 on FEMNIST with vanilla FedAvg (`pwd=FederatedScope/`): +Train ConvNet on FEMNIST with vanilla FedAvg: ```shell script +cd .. + python federatedscope/main.py --cfg federatedscope/cv/baseline/fedavg_convnet2_on_femnist.yaml # or -# python federatedscope/main.py --cfg federatedscope/example_configs/femnist.yaml +# python federatedscope/main.py --cfg scripts/example_configs/femnist.yaml ``` -Train convent-2 on CelebA with vanilla FedAvg (`pwd=FederatedScope/`): +Train ConvNet on CelebA with vanilla FedAvg: ```shell script +cd .. + python federatedscope/main.py --cfg federatedscope/cv/baseline/fedavg_convnet2_on_celeba.yaml ``` -Train convent-2 on FEMNIST with FedBN (`pwd=FederatedScope/`): +Train ConvNet on FEMNIST with FedBN (`pwd=FederatedScope/`): ```shell script +cd .. + python federatedscope/main.py --cfg federatedscope/cv/baseline/fedbn_convnet2_on_femnist.yaml ``` diff --git a/federatedscope/example_configs/distributed_client_1.yaml b/scripts/distributed_scripts/distributed_configs/distributed_client_1.yaml similarity index 100% rename from federatedscope/example_configs/distributed_client_1.yaml rename to scripts/distributed_scripts/distributed_configs/distributed_client_1.yaml diff --git a/federatedscope/example_configs/distributed_client_2.yaml b/scripts/distributed_scripts/distributed_configs/distributed_client_2.yaml similarity index 100% rename from federatedscope/example_configs/distributed_client_2.yaml rename to scripts/distributed_scripts/distributed_configs/distributed_client_2.yaml diff --git a/federatedscope/example_configs/distributed_client_3.yaml b/scripts/distributed_scripts/distributed_configs/distributed_client_3.yaml similarity index 100% rename from federatedscope/example_configs/distributed_client_3.yaml rename to scripts/distributed_scripts/distributed_configs/distributed_client_3.yaml diff --git a/federatedscope/example_configs/distributed_femnist_client_1.yaml b/scripts/distributed_scripts/distributed_configs/distributed_femnist_client_1.yaml similarity index 100% rename from federatedscope/example_configs/distributed_femnist_client_1.yaml rename to scripts/distributed_scripts/distributed_configs/distributed_femnist_client_1.yaml diff --git a/federatedscope/example_configs/distributed_femnist_client_2.yaml b/scripts/distributed_scripts/distributed_configs/distributed_femnist_client_2.yaml similarity index 100% rename from federatedscope/example_configs/distributed_femnist_client_2.yaml rename to scripts/distributed_scripts/distributed_configs/distributed_femnist_client_2.yaml diff --git a/federatedscope/example_configs/distributed_femnist_client_3.yaml b/scripts/distributed_scripts/distributed_configs/distributed_femnist_client_3.yaml similarity index 100% rename from federatedscope/example_configs/distributed_femnist_client_3.yaml rename to scripts/distributed_scripts/distributed_configs/distributed_femnist_client_3.yaml diff --git a/federatedscope/example_configs/distributed_femnist_server.yaml b/scripts/distributed_scripts/distributed_configs/distributed_femnist_server.yaml similarity index 100% rename from federatedscope/example_configs/distributed_femnist_server.yaml rename to scripts/distributed_scripts/distributed_configs/distributed_femnist_server.yaml diff --git a/federatedscope/example_configs/distributed_server.yaml b/scripts/distributed_scripts/distributed_configs/distributed_server.yaml similarity index 100% rename from federatedscope/example_configs/distributed_server.yaml rename to scripts/distributed_scripts/distributed_configs/distributed_server.yaml diff --git a/federatedscope/example_configs/distributed_server_no_data.yaml b/scripts/distributed_scripts/distributed_configs/distributed_server_no_data.yaml similarity index 100% rename from federatedscope/example_configs/distributed_server_no_data.yaml rename to scripts/distributed_scripts/distributed_configs/distributed_server_no_data.yaml diff --git a/scripts/gen_data.py b/scripts/distributed_scripts/gen_data.py similarity index 100% rename from scripts/gen_data.py rename to scripts/distributed_scripts/gen_data.py diff --git a/scripts/distributed_scripts/run_distributed_conv_femnist.sh b/scripts/distributed_scripts/run_distributed_conv_femnist.sh new file mode 100755 index 000000000..4f0fc2f58 --- /dev/null +++ b/scripts/distributed_scripts/run_distributed_conv_femnist.sh @@ -0,0 +1,17 @@ +set -e + +cd .. + +echo "Run distributed mode with ConvNet-2 on FEMNIST..." + +### server +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_femnist_server.yaml & +sleep 2 + +# clients +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_femnist_client_1.yaml & +sleep 2 +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_femnist_client_2.yaml & +sleep 2 +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_femnist_client_3.yaml & + diff --git a/scripts/distributed_scripts/run_distributed_lr.sh b/scripts/distributed_scripts/run_distributed_lr.sh new file mode 100755 index 000000000..361ebfcc4 --- /dev/null +++ b/scripts/distributed_scripts/run_distributed_lr.sh @@ -0,0 +1,22 @@ +set -e + +cd .. + +echo "Test distributed mode with LR..." + +echo "Data generation" +python scripts/gen_data.py + +### server owns global test data +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_server.yaml & +### server doesn't own data +# python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_server_no_data.yaml & +sleep 2 + +# clients +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_client_1.yaml & +sleep 2 +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_client_2.yaml & +sleep 2 +python federatedscope/main.py --cfg scripts/distributed_scripts/distributed_configs/distributed_client_3.yaml & + diff --git a/federatedscope/example_configs/asyn_cifar10.yaml b/scripts/example_configs/asyn_cifar10.yaml similarity index 100% rename from federatedscope/example_configs/asyn_cifar10.yaml rename to scripts/example_configs/asyn_cifar10.yaml diff --git a/federatedscope/example_configs/cora/hpo_ss_fedex.yaml b/scripts/example_configs/cora/hpo_ss_fedex.yaml similarity index 100% rename from federatedscope/example_configs/cora/hpo_ss_fedex.yaml rename to scripts/example_configs/cora/hpo_ss_fedex.yaml diff --git a/federatedscope/example_configs/cora/hpo_ss_fedex_arm.yaml b/scripts/example_configs/cora/hpo_ss_fedex_arm.yaml similarity index 100% rename from federatedscope/example_configs/cora/hpo_ss_fedex_arm.yaml rename to scripts/example_configs/cora/hpo_ss_fedex_arm.yaml diff --git a/federatedscope/example_configs/cora/hpo_ss_fedex_arm_table.yaml b/scripts/example_configs/cora/hpo_ss_fedex_arm_table.yaml similarity index 100% rename from federatedscope/example_configs/cora/hpo_ss_fedex_arm_table.yaml rename to scripts/example_configs/cora/hpo_ss_fedex_arm_table.yaml diff --git a/federatedscope/example_configs/cora/hpo_ss_fedex_grid.yaml b/scripts/example_configs/cora/hpo_ss_fedex_grid.yaml similarity index 100% rename from federatedscope/example_configs/cora/hpo_ss_fedex_grid.yaml rename to scripts/example_configs/cora/hpo_ss_fedex_grid.yaml diff --git a/federatedscope/example_configs/cora/hpo_ss_sha.yaml b/scripts/example_configs/cora/hpo_ss_sha.yaml similarity index 100% rename from federatedscope/example_configs/cora/hpo_ss_sha.yaml rename to scripts/example_configs/cora/hpo_ss_sha.yaml diff --git a/scripts/example_configs/cora/run.sh b/scripts/example_configs/cora/run.sh new file mode 100644 index 000000000..3d57fb137 --- /dev/null +++ b/scripts/example_configs/cora/run.sh @@ -0,0 +1,8 @@ +# SHA +python hpo.py --cfg scripts/example_configs/cora/sha.yaml + +# SHA wrap FedEX (FedEX related param) +python hpo.py --cfg scripts/example_configs/cora/sha_wrap_fedex.yaml + +# SHA wrap FedEX (arm) +python hpo.py --cfg scripts/example_configs/cora/sha_wrap_fedex_arm.yaml \ No newline at end of file diff --git a/federatedscope/example_configs/cora/sha.yaml b/scripts/example_configs/cora/sha.yaml similarity index 92% rename from federatedscope/example_configs/cora/sha.yaml rename to scripts/example_configs/cora/sha.yaml index 7c9de06c5..b2eff0477 100644 --- a/federatedscope/example_configs/cora/sha.yaml +++ b/scripts/example_configs/cora/sha.yaml @@ -38,7 +38,7 @@ hpo: scheduler: sha num_workers: 0 init_cand_num: 81 - ss: 'federatedscope/example_configs/cora/hpo_ss_sha.yaml' + ss: 'scripts/example_configs/cora/hpo_ss_sha.yaml' sha: budgets: [2, 4, 12, 36] metric: 'server_global_eval.val_avg_loss' diff --git a/federatedscope/example_configs/cora/sha_wrap_fedex.yaml b/scripts/example_configs/cora/sha_wrap_fedex.yaml similarity index 85% rename from federatedscope/example_configs/cora/sha_wrap_fedex.yaml rename to scripts/example_configs/cora/sha_wrap_fedex.yaml index 9cb8da898..822bbc9da 100644 --- a/federatedscope/example_configs/cora/sha_wrap_fedex.yaml +++ b/scripts/example_configs/cora/sha_wrap_fedex.yaml @@ -38,10 +38,10 @@ hpo: scheduler: sha num_workers: 0 init_cand_num: 81 - ss: 'federatedscope/example_configs/cora/hpo_ss_fedex.yaml' + ss: 'scripts/example_configs/cora/hpo_ss_fedex.yaml' sha: budgets: [2, 4, 12, 36] fedex: use: True - ss: 'federatedscope/example_configs/cora/hpo_ss_fedex_grid.yaml' + ss: 'scripts/example_configs/cora/hpo_ss_fedex_grid.yaml' metric: 'server_global_eval.val_avg_loss' diff --git a/federatedscope/example_configs/cora/sha_wrap_fedex_arm.yaml b/scripts/example_configs/cora/sha_wrap_fedex_arm.yaml similarity index 85% rename from federatedscope/example_configs/cora/sha_wrap_fedex_arm.yaml rename to scripts/example_configs/cora/sha_wrap_fedex_arm.yaml index 25adaea66..2e9b726ec 100644 --- a/federatedscope/example_configs/cora/sha_wrap_fedex_arm.yaml +++ b/scripts/example_configs/cora/sha_wrap_fedex_arm.yaml @@ -38,9 +38,9 @@ hpo: scheduler: wrap_sha num_workers: 0 init_cand_num: 81 - ss: 'federatedscope/example_configs/cora/hpo_ss_fedex_arm_table.yaml' + ss: 'scripts/example_configs/cora/hpo_ss_fedex_arm_table.yaml' table: - ss: 'federatedscope/example_configs/cora/hpo_ss_fedex_arm.yaml' + ss: 'scripts/example_configs/cora/hpo_ss_fedex_arm.yaml' num: 4 cand: 81 sha: diff --git a/federatedscope/example_configs/fed_node_cls.yaml b/scripts/example_configs/fed_node_cls.yaml similarity index 100% rename from federatedscope/example_configs/fed_node_cls.yaml rename to scripts/example_configs/fed_node_cls.yaml diff --git a/federatedscope/example_configs/fedex_flat_search_space.yaml b/scripts/example_configs/fedex_flat_search_space.yaml similarity index 100% rename from federatedscope/example_configs/fedex_flat_search_space.yaml rename to scripts/example_configs/fedex_flat_search_space.yaml diff --git a/federatedscope/example_configs/fedex_for_lr.yaml b/scripts/example_configs/fedex_for_lr.yaml similarity index 71% rename from federatedscope/example_configs/fedex_for_lr.yaml rename to scripts/example_configs/fedex_for_lr.yaml index 9923564d1..e636968d0 100644 --- a/federatedscope/example_configs/fedex_for_lr.yaml +++ b/scripts/example_configs/fedex_for_lr.yaml @@ -21,6 +21,6 @@ model: hpo: fedex: use: True -# ss: 'federatedscope/example_configs/fedex_flat_search_space.yaml' - ss: 'federatedscope/example_configs/fedex_grid_search_space.yaml' +# ss: 'scripts/example_configs/fedex_flat_search_space.yaml' + ss: 'scripts/example_configs/fedex_grid_search_space.yaml' diff: True diff --git a/federatedscope/example_configs/fedex_grid_search_space.yaml b/scripts/example_configs/fedex_grid_search_space.yaml similarity index 100% rename from federatedscope/example_configs/fedex_grid_search_space.yaml rename to scripts/example_configs/fedex_grid_search_space.yaml diff --git a/federatedscope/example_configs/femnist.yaml b/scripts/example_configs/femnist.yaml similarity index 100% rename from federatedscope/example_configs/femnist.yaml rename to scripts/example_configs/femnist.yaml diff --git a/federatedscope/example_configs/femnist/hpo_ss_fedex.yaml b/scripts/example_configs/femnist/hpo_ss_fedex.yaml similarity index 100% rename from federatedscope/example_configs/femnist/hpo_ss_fedex.yaml rename to scripts/example_configs/femnist/hpo_ss_fedex.yaml diff --git a/federatedscope/example_configs/femnist/hpo_ss_fedex_arm.yaml b/scripts/example_configs/femnist/hpo_ss_fedex_arm.yaml similarity index 100% rename from federatedscope/example_configs/femnist/hpo_ss_fedex_arm.yaml rename to scripts/example_configs/femnist/hpo_ss_fedex_arm.yaml diff --git a/federatedscope/example_configs/femnist/hpo_ss_fedex_arm_table.yaml b/scripts/example_configs/femnist/hpo_ss_fedex_arm_table.yaml similarity index 100% rename from federatedscope/example_configs/femnist/hpo_ss_fedex_arm_table.yaml rename to scripts/example_configs/femnist/hpo_ss_fedex_arm_table.yaml diff --git a/federatedscope/example_configs/femnist/hpo_ss_fedex_grid.yaml b/scripts/example_configs/femnist/hpo_ss_fedex_grid.yaml similarity index 100% rename from federatedscope/example_configs/femnist/hpo_ss_fedex_grid.yaml rename to scripts/example_configs/femnist/hpo_ss_fedex_grid.yaml diff --git a/federatedscope/example_configs/femnist/hpo_ss_sha.yaml b/scripts/example_configs/femnist/hpo_ss_sha.yaml similarity index 100% rename from federatedscope/example_configs/femnist/hpo_ss_sha.yaml rename to scripts/example_configs/femnist/hpo_ss_sha.yaml diff --git a/scripts/example_configs/femnist/run.sh b/scripts/example_configs/femnist/run.sh new file mode 100644 index 000000000..803e70cc9 --- /dev/null +++ b/scripts/example_configs/femnist/run.sh @@ -0,0 +1,8 @@ +# SHA +python hpo.py --cfg scripts/example_configs/femnist/sha.yaml + +# SHA wrap FedEX (FedEX related param) +python hpo.py --cfg scripts/example_configs/femnist/sha_wrap_fedex.yaml + +# SHA wrap FedEX (arm) +python hpo.py --cfg scripts/example_configs/femnist/sha_wrap_fedex_arm.yaml \ No newline at end of file diff --git a/federatedscope/example_configs/femnist/sha.yaml b/scripts/example_configs/femnist/sha.yaml similarity index 93% rename from federatedscope/example_configs/femnist/sha.yaml rename to scripts/example_configs/femnist/sha.yaml index b7f380166..2207777a9 100644 --- a/federatedscope/example_configs/femnist/sha.yaml +++ b/scripts/example_configs/femnist/sha.yaml @@ -43,7 +43,7 @@ hpo: scheduler: sha num_workers: 0 init_cand_num: 27 - ss: 'federatedscope/example_configs/femnist/hpo_ss_sha.yaml' + ss: 'scripts/example_configs/femnist/hpo_ss_sha.yaml' sha: budgets: [12, 13, 19] metric: 'client_summarized_weighted_avg.val_avg_loss' diff --git a/federatedscope/example_configs/femnist/sha_wrap_fedex.yaml b/scripts/example_configs/femnist/sha_wrap_fedex.yaml similarity index 87% rename from federatedscope/example_configs/femnist/sha_wrap_fedex.yaml rename to scripts/example_configs/femnist/sha_wrap_fedex.yaml index 808bc515e..56d3602a3 100644 --- a/federatedscope/example_configs/femnist/sha_wrap_fedex.yaml +++ b/scripts/example_configs/femnist/sha_wrap_fedex.yaml @@ -43,10 +43,10 @@ hpo: scheduler: sha num_workers: 0 init_cand_num: 81 - ss: 'federatedscope/example_configs/femnist/hpo_ss_fedex.yaml' + ss: 'scripts/example_configs/femnist/hpo_ss_fedex.yaml' sha: budgets: [2, 4, 12, 36] fedex: use: True - ss: 'federatedscope/example_configs/femnist/hpo_ss_fedex_grid.yaml' + ss: 'scripts/example_configs/femnist/hpo_ss_fedex_grid.yaml' metric: 'client_summarized_weighted_avg.val_avg_loss' diff --git a/federatedscope/example_configs/femnist/sha_wrap_fedex_arm.yaml b/scripts/example_configs/femnist/sha_wrap_fedex_arm.yaml similarity index 82% rename from federatedscope/example_configs/femnist/sha_wrap_fedex_arm.yaml rename to scripts/example_configs/femnist/sha_wrap_fedex_arm.yaml index 520f8ce45..b83786eec 100644 --- a/federatedscope/example_configs/femnist/sha_wrap_fedex_arm.yaml +++ b/scripts/example_configs/femnist/sha_wrap_fedex_arm.yaml @@ -43,9 +43,9 @@ hpo: scheduler: wrap_sha num_workers: 0 init_cand_num: 27 - ss: 'federatedscope/example_configs/femnist/hpo_ss_fedex_arm_table.yaml' + ss: 'scripts/example_configs/femnist/hpo_ss_fedex_arm_table.yaml' table: - ss: 'federatedscope/example_configs/femnist/hpo_ss_fedex_arm.yaml' + ss: 'scripts/example_configs/femnist/hpo_ss_fedex_arm.yaml' num: 27 cand: 81 sha: diff --git a/federatedscope/example_configs/femnist_global_train.yaml b/scripts/example_configs/femnist_global_train.yaml similarity index 100% rename from federatedscope/example_configs/femnist_global_train.yaml rename to scripts/example_configs/femnist_global_train.yaml diff --git a/federatedscope/example_configs/openml_lr.yaml b/scripts/example_configs/openml_lr.yaml similarity index 100% rename from federatedscope/example_configs/openml_lr.yaml rename to scripts/example_configs/openml_lr.yaml diff --git a/federatedscope/example_configs/quadratic.yaml b/scripts/example_configs/quadratic.yaml similarity index 100% rename from federatedscope/example_configs/quadratic.yaml rename to scripts/example_configs/quadratic.yaml diff --git a/federatedscope/example_configs/quadratic_clientwise.yaml b/scripts/example_configs/quadratic_clientwise.yaml similarity index 100% rename from federatedscope/example_configs/quadratic_clientwise.yaml rename to scripts/example_configs/quadratic_clientwise.yaml diff --git a/federatedscope/example_configs/sha_wrap_fedex.yaml b/scripts/example_configs/sha_wrap_fedex.yaml similarity index 66% rename from federatedscope/example_configs/sha_wrap_fedex.yaml rename to scripts/example_configs/sha_wrap_fedex.yaml index 8ca271af1..5bf9240c0 100644 --- a/federatedscope/example_configs/sha_wrap_fedex.yaml +++ b/scripts/example_configs/sha_wrap_fedex.yaml @@ -20,11 +20,11 @@ hpo: scheduler: sha num_workers: 1 init_cand_num: 5 - ss: federatedscope/example_configs/sha_wrap_fedex_ss.yaml + ss: scripts/example_configs/sha_wrap_fedex_ss.yaml sha: budgets: [2, 4] fedex: use: True - ss: 'federatedscope/example_configs/fedex_flat_search_space.yaml' -# ss: 'federatedscope/example_configs/fedex_grid_search_space.yaml' + ss: 'scripts/example_configs/fedex_flat_search_space.yaml' +# ss: 'scripts/example_configs/fedex_grid_search_space.yaml' diff: True diff --git a/federatedscope/example_configs/sha_wrap_fedex_arm.yaml b/scripts/example_configs/sha_wrap_fedex_arm.yaml similarity index 86% rename from federatedscope/example_configs/sha_wrap_fedex_arm.yaml rename to scripts/example_configs/sha_wrap_fedex_arm.yaml index b534988a5..8fdda9d2b 100644 --- a/federatedscope/example_configs/sha_wrap_fedex_arm.yaml +++ b/scripts/example_configs/sha_wrap_fedex_arm.yaml @@ -23,7 +23,7 @@ hpo: #num_workers: 1 num_workers: 0 init_cand_num: 5 - ss: 'federatedscope/example_configs/sha_wrap_fedex_ss_table.yaml' + ss: 'scripts/example_configs/sha_wrap_fedex_ss_table.yaml' table: num: 4 sha: diff --git a/federatedscope/example_configs/sha_wrap_fedex_ss.yaml b/scripts/example_configs/sha_wrap_fedex_ss.yaml similarity index 100% rename from federatedscope/example_configs/sha_wrap_fedex_ss.yaml rename to scripts/example_configs/sha_wrap_fedex_ss.yaml diff --git a/federatedscope/example_configs/sha_wrap_fedex_ss_table.yaml b/scripts/example_configs/sha_wrap_fedex_ss_table.yaml similarity index 100% rename from federatedscope/example_configs/sha_wrap_fedex_ss_table.yaml rename to scripts/example_configs/sha_wrap_fedex_ss_table.yaml diff --git a/federatedscope/example_configs/single_process.yaml b/scripts/example_configs/single_process.yaml similarity index 100% rename from federatedscope/example_configs/single_process.yaml rename to scripts/example_configs/single_process.yaml diff --git a/federatedscope/example_configs/toy_hpo_ss.yaml b/scripts/example_configs/toy_hpo_ss.yaml similarity index 100% rename from federatedscope/example_configs/toy_hpo_ss.yaml rename to scripts/example_configs/toy_hpo_ss.yaml diff --git a/federatedscope/example_configs/toy_rs.yaml b/scripts/example_configs/toy_rs.yaml similarity index 81% rename from federatedscope/example_configs/toy_rs.yaml rename to scripts/example_configs/toy_rs.yaml index 4a27d5121..dbc6fe433 100644 --- a/federatedscope/example_configs/toy_rs.yaml +++ b/scripts/example_configs/toy_rs.yaml @@ -15,4 +15,4 @@ data: hpo: num_workers: 3 init_cand_num: 3 - ss: federatedscope/example_configs/toy_hpo_ss.yaml + ss: scripts/example_configs/toy_hpo_ss.yaml diff --git a/federatedscope/example_configs/toy_sha.yaml b/scripts/example_configs/toy_sha.yaml similarity index 84% rename from federatedscope/example_configs/toy_sha.yaml rename to scripts/example_configs/toy_sha.yaml index 0aa8d0c32..ed72cc924 100644 --- a/federatedscope/example_configs/toy_sha.yaml +++ b/scripts/example_configs/toy_sha.yaml @@ -17,6 +17,6 @@ hpo: scheduler: sha num_workers: 0 init_cand_num: 5 - ss: federatedscope/example_configs/toy_hpo_ss.yaml + ss: scripts/example_configs/toy_hpo_ss.yaml sha: budgets: [1, 1] diff --git a/scripts/run_distributed_conv_femnist.sh b/scripts/run_distributed_conv_femnist.sh deleted file mode 100755 index 61c9a19ad..000000000 --- a/scripts/run_distributed_conv_femnist.sh +++ /dev/null @@ -1,15 +0,0 @@ -set -e - -echo "Run distributed mode with ConvNet-2 on FEMNIST..." - -### server -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_femnist_server.yaml & -sleep 2 - -# clients -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_femnist_client_1.yaml & -sleep 2 -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_femnist_client_2.yaml & -sleep 2 -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_femnist_client_3.yaml & - diff --git a/scripts/run_distributed_lr.sh b/scripts/run_distributed_lr.sh deleted file mode 100755 index 864a5da4a..000000000 --- a/scripts/run_distributed_lr.sh +++ /dev/null @@ -1,20 +0,0 @@ -set -e - -echo "Test distributed mode with LR..." - -echo "Data generation" -python scripts/gen_data.py - -### server owns global test data -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_server.yaml & -### server doesn't own data -# python federatedscope/main.py --cfg federatedscope/example_configs/distributed_server_no_data.yaml & -sleep 2 - -# clients -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_client_1.yaml & -sleep 2 -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_client_2.yaml & -sleep 2 -python federatedscope/main.py --cfg federatedscope/example_configs/distributed_client_3.yaml & - diff --git a/tests/test_efficient_simulation.py b/tests/test_efficient_simulation.py index f6f332374..e90b8cf21 100644 --- a/tests/test_efficient_simulation.py +++ b/tests/test_efficient_simulation.py @@ -14,8 +14,7 @@ def setUp(self): def test_toy_example_standalone_cmp_sim_impl(self): case_cfg = global_cfg.clone() - case_cfg.merge_from_file( - 'federatedscope/example_configs/single_process.yaml') + case_cfg.merge_from_file('scripts/example_configs/single_process.yaml') setup_seed(case_cfg.seed) update_logger(case_cfg) diff --git a/tests/test_yaml.py b/tests/test_yaml.py index d320a9ee4..ff0570377 100644 --- a/tests/test_yaml.py +++ b/tests/test_yaml.py @@ -10,9 +10,7 @@ class YAMLTest(unittest.TestCase): def setUp(self): - self.exclude_all = [ - 'benchmark', 'scripts', 'federatedscope/example_configs' - ] + self.exclude_all = ['benchmark', 'scripts'] self.exclude_file = [ '.pre-commit-config.yaml', 'meta.yaml', 'federatedscope/gfl/baseline/isolated_gin_minibatch_on_cikmcup_per_client.yaml',