mirror of https://github.com/microsoft/autogen.git
V0.5.6 (#128)
* recover ConcurrencyLimiter * cost attribute * update notebooks Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qiw@microsoft.com>
This commit is contained in:
parent
a291abfab9
commit
b04b00dc9d
|
@ -981,9 +981,15 @@ class AutoML:
|
|||
self._retrained_config = {}
|
||||
est_retrain_time = next_trial_time = 0
|
||||
best_config_sig = None
|
||||
# use ConcurrencyLimiter to limit the amount of concurrency when
|
||||
# using a search algorithm
|
||||
better = True # whether we find a better model in one trial
|
||||
if self._ensemble:
|
||||
self.best_model = {}
|
||||
try:
|
||||
from ray.tune.suggest import ConcurrencyLimiter
|
||||
except ImportError:
|
||||
from .searcher.suggestion import ConcurrencyLimiter
|
||||
if self._hpo_method in ('cfo', 'grid'):
|
||||
from flaml import CFO as SearchAlgo
|
||||
elif 'optuna' == self._hpo_method:
|
||||
|
@ -1056,11 +1062,13 @@ class AutoML:
|
|||
metric='val_loss', mode='min', space=search_space,
|
||||
points_to_evaluate=points_to_evaluate,
|
||||
)
|
||||
search_state.search_alg = algo
|
||||
search_state.search_alg = ConcurrencyLimiter(algo,
|
||||
max_concurrent=1)
|
||||
else:
|
||||
search_space = None
|
||||
if self._hpo_method in ('bs', 'cfo'):
|
||||
search_state.search_alg.set_search_properties(
|
||||
metric=None, mode=None,
|
||||
config={
|
||||
'metric_target': self._state.best_loss,
|
||||
},
|
||||
|
|
|
@ -133,8 +133,8 @@ class BlendSearch(Searcher):
|
|||
else:
|
||||
self._gs = None
|
||||
self._ls = self.LocalSearch(
|
||||
init_config, metric, mode, cat_hp_cost, space,
|
||||
prune_attr, min_resource, max_resource, reduction_factor, seed)
|
||||
init_config, metric, mode, cat_hp_cost, space, prune_attr,
|
||||
min_resource, max_resource, reduction_factor, self.cost_attr, seed)
|
||||
self._init_search()
|
||||
|
||||
def set_search_properties(self,
|
||||
|
|
|
@ -26,7 +26,6 @@ class FLOW2(Searcher):
|
|||
|
||||
STEPSIZE = 0.1
|
||||
STEP_LOWER_BOUND = 0.0001
|
||||
cost_attr = 'time_total_s'
|
||||
|
||||
def __init__(self,
|
||||
init_config: dict,
|
||||
|
@ -38,6 +37,7 @@ class FLOW2(Searcher):
|
|||
min_resource: Optional[float] = None,
|
||||
max_resource: Optional[float] = None,
|
||||
resource_multiple_factor: Optional[float] = 4,
|
||||
cost_attr: Optional[str] = 'time_total_s',
|
||||
seed: Optional[int] = 20):
|
||||
'''Constructor
|
||||
|
||||
|
@ -73,6 +73,7 @@ class FLOW2(Searcher):
|
|||
prune_attr; only valid if prune_attr is not in space.
|
||||
resource_multiple_factor: A float of the multiplicative factor
|
||||
used for increasing resource.
|
||||
cost_attr: A string of the attribute used for cost.
|
||||
seed: An integer of the random seed.
|
||||
'''
|
||||
if mode:
|
||||
|
@ -98,6 +99,7 @@ class FLOW2(Searcher):
|
|||
self.prune_attr = prune_attr
|
||||
self.min_resource = min_resource
|
||||
self.resource_multiple_factor = resource_multiple_factor or 4
|
||||
self.cost_attr = cost_attr
|
||||
self.max_resource = max_resource
|
||||
self._resource = None
|
||||
self._step_lb = np.Inf
|
||||
|
@ -292,7 +294,7 @@ class FLOW2(Searcher):
|
|||
init_config, self.metric, self.mode, self._cat_hp_cost,
|
||||
unflatten_dict(self.space), self.prune_attr,
|
||||
self.min_resource, self.max_resource,
|
||||
self.resource_multiple_factor, self._seed + 1)
|
||||
self.resource_multiple_factor, self.cost_attr, self._seed + 1)
|
||||
flow2.best_obj = obj * self.metric_op # minimize internally
|
||||
flow2.cost_incumbent = cost
|
||||
self._seed += 1
|
||||
|
@ -534,7 +536,7 @@ class FLOW2(Searcher):
|
|||
config[self.prune_attr] = self._resource
|
||||
self._direction_tried = None
|
||||
self._configs[trial_id] = (config, self.step)
|
||||
return config
|
||||
return unflatten_dict(config)
|
||||
self._num_allowed4incumbent -= 1
|
||||
move = self.incumbent.copy()
|
||||
if self._direction_tried is not None:
|
||||
|
@ -553,7 +555,7 @@ class FLOW2(Searcher):
|
|||
self._proposed_by[trial_id] = self.incumbent
|
||||
self._configs[trial_id] = (config, self.step)
|
||||
self._num_proposedby_incumbent += 1
|
||||
best_config = flatten_dict(self.best_config)
|
||||
best_config = self.best_config
|
||||
if self._init_phase:
|
||||
if self._direction_tried is None:
|
||||
if self._same:
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = "0.5.5"
|
||||
__version__ = "0.5.6"
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue