def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument( 'offline', default='False', type=str, help= 'Run offline (data can be streamed later to wandb servers)', is_bool=True), Argument('anonymous', default='False', type=str, help='Enables or explicitly disables anonymous logging', is_bool=True), Argument( 'project', default=None, type=str, help='The name of the project to which this run will belong'), Argument( 'log_model', default='False', type=str, help='Save checkpoints in wandb dir to upload on W&B servers', is_bool=True), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ args = super().args_to_add(index) + [ Argument('data_shape', default='3, 224, 224', type=str, help='shape of the data'), Argument('target_shape', default='1000', type=str, help='shape of the targets'), ] return args
def new_task(cls, cla: cla_type = None, args_changes: dict = None, raise_unparsed=True) -> AbstractTask: """ :param cla: str: path to run_config file(s), (separated by commas), overrules other command line args if this exists list: specified command line arguments, overrules default system arguments None: use the system arguments :param args_changes: optional dictionary of changes to the command line arguments :param raise_unparsed: raise an exception if there are unparsed arguments left :return: new task as defined by the command line arguments """ print("Creating new task") # reset any plotting plt.clf() plt.cla() # make sure everything is registered Builder() # from config file? if isinstance(cla, str): cla = arg_list_from_json(cla) print('-' * 50) # get arguments, insert args_changes args_list = sys.argv[1:] if cla is None else cla args_changes = args_changes if args_changes is not None else {} for k, v in args_changes.items(): cla.append('--%s=%s' % (k, v)) parser = argparse.ArgumentParser(description='UniNAS Project') node = ArgsTreeNode(Main) node.build_from_args(args_list, parser) args, wildcards, failed_args, descriptions = node.parse( args_list, parser, raise_unparsed=raise_unparsed) # note failed wildcards if len(failed_args) > 0: print('-' * 50) print('Failed replacements for argparse:') print(', '.join(failed_args)) # list all wildcards for convenience print('-' * 50) print('Wildcard replacements for argparse:') for k, v in wildcards.items(): print('\t{:<25} -> {}'.format('{%s}' % k, v)) print('-' * 50) # clean up, create and return the task Argument.reset_cached() cls_task = cls._parsed_meta_argument(Register.tasks, 'cls_task', args, index=None) print('Starting %s!' % cls_task.__name__) return cls_task(args, wildcards, descriptions=descriptions)
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('load', default="False", type=str, help='load the cached weights or continue', is_bool=True), Argument('batches_forward', default=0, type=int, help='num batches to forward the network, to adapt bn'), Argument('batches_train', default=0, type=int, help='num batches to train the network, -1 for an epoch'), Argument('batches_eval', default=-1, type=int, help='num batches to train the network, -1 for an epoch'), Argument('value', default='val/accuracy/1', type=str, help='which top k value to optimize'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('features_mul', default=1, type=int, help='global width multiplier for stem, cells'), Argument('features_first_cell', default=-1, type=int, help='fixed num output features of the first cell if >0'), Argument('cell_order', default="n, r, n", type=str, help='arrangement of cells'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('features', default=1280, type=int, help='num features after the 1x1 convolution'), Argument('act_fun', default='relu', type=str, help='act fun of the 1x1 convolution', choices=Register.act_funs.names()), Argument('bias', default='True', type=str, help='add a bias', is_bool=True), Argument('dropout', default=0.0, type=float, help='initial dropout probability'), Argument('gap_first', default='False', type=str, help='GAP before the convolution', is_bool=True), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('each_samples', default=-1, type=int, help='step the scheduler each n samples instead of each epoch, if >0 (does not account for accumulated gradients)'), Argument('cooldown_epochs', default=0, type=int, help='remain at the final lr at the end'), Argument('warmup_epochs', default=0, type=int, help='linearly increase the lr to the initial lr over this many epochs, start the regular scheduler afterwards'), Argument('warmup_lr', default=0.0, type=float, help='initial lr when using warmup, the first value is skipped'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('pop_size', default=5, type=int, help='population size'), Argument('n_offsprings', default=10, type=int, help='num offspring per generation'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ mixed_ops = Register.network_mixed_ops.names() return super().args_to_add(index) + [ Argument('strategy_name', default="default", type=str, help='under which strategy to register'), Argument('fused', default="False", type=str, is_bool=True, help='use a fused operation'), Argument('mixed_cls', default=MixedOp.__name__, type=str, choices=mixed_ops, help='class for mixed op'), Argument('subset', default="", type=str, help='[int] use only these operations, must not be fused'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('each_epochs', default=1, type=int, help="only synchronize each n epochs"), Argument('grace_epochs', default=0, type=int, help="skip synchronization for the first n epochs"), Argument('save_ema', default="True", type=str, is_bool=True, help="save the EMA-model weights if available, otherwise save the trained model's weights"), Argument('elitist', default="True", type=str, is_bool=True, help="elitist: keep old checkpoints if they are better"), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('type', default='int', type=str, choices=['int', 'real'], help='?'), Argument('eta', default=30, type=int, help='?'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument( 'p', default=1.0, type=float, help="probability to mutate"), Argument('init_factor', default=1.0, type=float, help="get initial values between v/init and v*init"), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return [ Argument('lr', default=0.01, type=float, help='learning rate'), Argument('momentum', default=0.9, type=float, help='momentum'), Argument('nesterov', default='False', type=str, help='use nesterov', is_bool=True), ] + super().args_to_add(index)
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('tau0', default=10, type=float, help='initial tau value for softmax annealing'), Argument('tauN', default=0.1, type=float, help='final tau value for softmax annealing'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return [ Argument('milestones', default="50, 100", type=str, help='List of epoch indices. Must be increasing'), Argument('gamma', default=0.1, type=float, help='Multiplicative factor of learning rate decay'), ] + super().args_to_add(index)
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('measure_top', default='10, 50', type=str, help='measure top-N bench architectures'), Argument('measure_correlations', default='KendallTauCorrelation', type=str, help='correlations to measure'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('default_data_set', default="", type=str, help='default data set to use, ignored if empty'), Argument('default_result_type', default="test", type=str, choices=['train', 'valid', 'test'], help='default result type to use'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return [ Argument('lr', default=0.01, type=float, help='learning rate'), Argument('eps', default=1e-8, type=float, help='epsilon value'), Argument('beta1', default=0.9, type=float, help='beta1 value'), Argument('beta2', default=0.999, type=float, help='beta2 value'), Argument('amsgrad', default='False', type=str, help='use amsgrad', is_bool=True), ] + super().args_to_add(index)
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument( 'replace_worst', default=0.3, type=float, help="percentage of worst performing individuals to replace"), Argument('copy_best', default=0.2, type=float, help="percentage of best performing individuals to copy"), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('bias', default='True', type=str, help='add a bias', is_bool=True), Argument('dropout', default=0.0, type=float, help='dropout, <0 to disable entirely'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('plot_true_pareto', default='False', type=str, help='add the true pareto front', is_bool=True), Argument('mask_indices', default="", type=str, help='[int] mask specific primitives from being used'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('num_blocks', default=3, type=int, help='num blocks in the cell'), Argument('cls_block', default='Bench201CNNSearchBlock', type=str, help='class to use as block', choices=Register.network_blocks.names()), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return [ Argument('lr', default=0.01, type=float, help='learning rate'), Argument('alpha', default=0.99, type=float, help='alpha value'), Argument('eps', default=1e-8, type=float, help='epsilon value'), Argument('momentum', default=0.0, type=float, help='momentum'), Argument('centered', default='False', type=str, help='centered', is_bool=True), ] + super().args_to_add(index)
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('search_config_path', type=str, default='not_set', help='path to the search dir', is_path=True), Argument('gene', default='random', type=str, help='"random" or [int] gene of weights in super-net'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument( 'name', type=str, default='c', help='name for the cell order'), Argument('features_mult', type=int, default=-1, help='dynamic number of output features'), Argument('features_fixed', type=int, default=-1, help='fixed number of output features'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse for when this class is chosen """ return super().args_to_add(index) + [ Argument( 'arc_shared', type=str, default='False', help='whether to use arc_key to share architecture/topology', is_bool=True), Argument('arc_key', type=str, default='c', help='key for sharing arc weights'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('se_cmul', default=0.25, type=float, help='use Squeeze+Excitation with given width'), Argument('se_squeeze_bias', default='True', type=str, help='use SE bias for squeezing', is_bool=True), Argument('se_excite_bias', default='True', type=str, help='use SE bias for exciting', is_bool=True), Argument('se_act_fun', default='relu', type=str, help='use Squeeze+Excitation with given act fun'), Argument('se_bn', default='True', type=str, help='use Squeeze+Excitation with bn', is_bool=True), Argument('features', default=1280, type=int, help='num features after the first fc layer'), Argument('act_fun', default='relu', type=str, help='act fun of the first fc layer', choices=Register.act_funs.names()), Argument('bias0', default='False', type=str, help='add a bias to the first fc layer', is_bool=True), Argument('dropout', default=0.0, type=float, help='initial dropout probability'), Argument('bias1', default='False', type=str, help='add a bias to the final fc layer', is_bool=True), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument( 'same_dataset', default='False', type=str, is_bool=True, help= "correlate only if the bench results are on the same dataset"), Argument('measure_correlations', default='KendallTauCorrelation', type=str, help='correlations to measure'), ]
def args_to_add(cls, index=None) -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return super().args_to_add(index) + [ Argument('config_path', default='', type=str, help='path to the mmdet config', is_path=True), Argument( 'use_config_pretrained', default='False', type=str, is_bool=True, help='Use the pretrained weights defined in the config'), ]
def common_s2_net_args_to_add() -> [Argument]: """ list arguments to add to argparse when this class (or a child class) is chosen """ return [ # loading network / weights from a previous training session Argument('s1_path', default='{path_tmp}', type=str, help='save dir of s1 training', is_path=True), Argument('reset_bn', default='False', type=str, help='reset batch norm stats', is_bool=True), ]