A programming framework for agentic AI
simplify warmstart in blendsearch (#558)
Chi Wangc35b8440305b
diff --git a/flaml/searcher/blendsearch.py b/flaml/searcher/blendsearch.pyindex f2cedfd15..00dddec76 100644--- a/flaml/searcher/blendsearch.py+++ b/flaml/searcher/blendsearch.py@@ -311,25 +311,6 @@ class BlendSearch(Searcher):)self._gs_admissible_min = self._ls_bound_min.copy()self._gs_admissible_max = self._ls_bound_max.copy()- # config_signature: tuple -> result: Dict- self._result = (- {- self._ls.config_signature(- *self._ls.complete_config(- self._evaluated_points[i],- self._ls_bound_min,- self._ls_bound_max,- )- ): {- self._metric: r,- self.cost_attr: 1,- "config": self._evaluated_points[i],- }- for i, r in enumerate(self._all_rewards)- }- if self._evaluated_rewards # store all the evaluated rewards- else {}- )if self._metric_constraints:self._metric_constraint_satisfied = False@@ -340,6 +321,14 @@ class BlendSearch(Searcher):self._metric_constraint_satisfied = Trueself._metric_constraint_penalty = Noneself.best_resource = self._ls.min_resource+ i = 0+ # config_signature: tuple -> result: Dict+ self._result = {}+ while self._evaluated_rewards:+ # go over the evaluated rewards+ trial_id = f"trial_for_evaluated_{i}"+ self.suggest(trial_id)+ i += 1def save(self, checkpoint_path: str):"""save states to a checkpoint path."""@@ -747,8 +736,8 @@ class BlendSearch(Searcher):self._search_thread_pool[0].running += 1self._subspace[trial_id] = spaceif reward is not None:- # result = {self._metric: reward, self.cost_attr: 1, "config": config}- result = self._result[config_signature]+ result = {self._metric: reward, self.cost_attr: 1, "config": config}+ # result = self._result[config_signature]self.on_trial_complete(trial_id, result)return Noneif self._use_incumbent_result_in_evaluation:diff --git a/flaml/version.py b/flaml/version.pyindex 7863915fa..976498ab9 100644--- a/flaml/version.py+++ b/flaml/version.py@@ -1 +1 @@-__version__ = "1.0.2"+__version__ = "1.0.3"