forked from TalwalkarLab/leaf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
108 additions
and
174 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
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import argparse | ||
|
||
from .constants import DATASETS, SIM_TIMES | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument('-dataset', | ||
help='name of dataset;', | ||
type=str, | ||
choices=DATASETS, | ||
required=True) | ||
parser.add_argument('-model', | ||
help='name of model;', | ||
type=str, | ||
required=True) | ||
parser.add_argument('--num-rounds', | ||
help='number of rounds to simulate;', | ||
type=int, | ||
default=-1) | ||
parser.add_argument('--eval-every', | ||
help='evaluate every ____ rounds;', | ||
type=int, | ||
default=-1) | ||
parser.add_argument('--clients-per-round', | ||
help='number of clients trained per round;', | ||
type=int, | ||
default=-1) | ||
parser.add_argument('--batch-size', | ||
help='batch size when clients train on data;', | ||
type=int, | ||
default=10) | ||
parser.add_argument('--seed', | ||
help='seed for random client sampling and batch splitting', | ||
type=int, | ||
default=0) | ||
|
||
# Minibatch doesn't support num_epochs, so make them mutually exclusive | ||
epoch_capability_group = parser.add_mutually_exclusive_group() | ||
epoch_capability_group.add_argument('--minibatch', | ||
help='None for FedAvg, else fraction;', | ||
type=float, | ||
default=None) | ||
epoch_capability_group.add_argument('--num-epochs', | ||
help='number of epochs when clients train on data;', | ||
type=int, | ||
default=1) | ||
|
||
parser.add_argument('-t', | ||
help='simulation time: small, medium, or large;', | ||
type=str, | ||
choices=SIM_TIMES, | ||
default='large') | ||
parser.add_argument('-lr', | ||
help='learning rate for local optimizers;', | ||
type=float, | ||
default=-1, | ||
required=False) | ||
|
||
return parser.parse_args() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
DATASETS = ['sent140', 'femnist', 'shakespeare'] | ||
DATASETS = ['sent140', 'femnist', 'shakespeare'] | ||
|
||
"""list: Common sets of configuration for simulations""" | ||
SIM_TIMES = ['small', 'medium', 'large'] |
Oops, something went wrong.