def test_arch_knob_without_enas_policies(self, day_budget, arch_knob): knob_config = { 'arch': arch_knob, 'downscale': PolicyKnob('DOWNSCALE'), 'early_stop': PolicyKnob('EARLY_STOP'), 'skip_train': PolicyKnob('SKIP_TRAIN') # No quick eval } advisor = make_advisor(knob_config, day_budget) assert isinstance(advisor, RandomAdvisor)
def test_arch_knob_without_budget(self, budget, arch_knob): knob_config = { 'arch': arch_knob, 'fixed': FixedKnob('fixed'), 'downscale': PolicyKnob('DOWNSCALE'), 'early_stop': PolicyKnob('EARLY_STOP'), 'skip_train': PolicyKnob('SKIP_TRAIN'), 'quick_eval': PolicyKnob('QUICK_EVAL') } advisor = make_advisor(knob_config, budget) assert isinstance(advisor, RandomAdvisor)
def test_arch_knob_with_enas_policies(self, day_budget, arch_knob): knob_config = { 'arch': arch_knob, 'fixed': FixedKnob('fixed'), 'share_params': PolicyKnob('SHARE_PARAMS'), 'downscale': PolicyKnob('DOWNSCALE'), 'early_stop': PolicyKnob('EARLY_STOP'), 'skip_train': PolicyKnob('SKIP_TRAIN'), 'quick_eval': PolicyKnob('QUICK_EVAL') } advisor = make_advisor(knob_config, day_budget) assert isinstance(advisor, EnasAdvisor)
def get_knob_config(): return { 'int': IntegerKnob(1, 32), 'float': FloatKnob(1e-5, 1), 'cat': CategoricalKnob(['a', 'b', 'c']), 'fixed': FixedKnob('fixed'), 'policy': PolicyKnob('EARLY_STOP') }
def get_knob_config(): return { 'trial_epochs': FixedKnob(300), 'lr': FloatKnob(1e-4, 1, is_exp=True), 'lr_decay': FloatKnob(1e-3, 1e-1, is_exp=True), 'opt_momentum': FloatKnob(0.7, 1, is_exp=True), 'opt_weight_decay': FloatKnob(1e-5, 1e-3, is_exp=True), 'batch_size': CategoricalKnob([32, 64, 128]), 'drop_rate': FloatKnob(0, 0.4), 'max_image_size': FixedKnob(32), 'share_params': PolicyKnob('SHARE_PARAMS'), # Affects whether training is shortened by using early stopping 'quick_train': PolicyKnob('EARLY_STOP'), 'early_stop_train_val_samples': FixedKnob(1024), 'early_stop_patience_epochs': FixedKnob(5) }
def test_fixed_knobs(self, budget): knob_config = { 'fixed': FixedKnob('fixed'), 'fixed2': FixedKnob(2), 'early_stop': PolicyKnob('EARLY_STOP') } advisor = make_advisor(knob_config, budget) assert isinstance(advisor, FixedAdvisor)
def test_standard_knobs_with_params_sharing(self, budget): knob_config = { 'int': IntegerKnob(2, 128), 'float': FloatKnob(1e-5, 1e-1, is_exp=True), 'cat': CategoricalKnob([16, 32, 64, 128]), 'share_params': PolicyKnob('SHARE_PARAMS') } advisor = make_advisor(knob_config, budget) assert isinstance(advisor, BayesOptWithParamSharingAdvisor)
def test_standard_knobs_with_early_stop(self, budget): knob_config = { 'int': IntegerKnob(2, 128), 'float': FloatKnob(1e-5, 1e-1, is_exp=True), 'cat': CategoricalKnob([16, 32, 64, 128]), 'early_stop': PolicyKnob('EARLY_STOP') } advisor = make_advisor(knob_config, budget) assert isinstance(advisor, BayesOptAdvisor)
def get_knob_config(): return { 'max_epochs': FixedKnob(10), 'hidden_layer_count': IntegerKnob(1, 2), 'hidden_layer_units': IntegerKnob(2, 128), 'learning_rate': FloatKnob(1e-5, 1e-1, is_exp=True), 'batch_size': CategoricalKnob([16, 32, 64, 128]), 'max_image_size': CategoricalKnob([16, 32, 48]), 'quick_train': PolicyKnob('EARLY_STOP') # Whether early stopping would be used }