Merge branch 'microsoft:main' into main

This commit is contained in:
zsk
2022-06-23 23:26:14 -04:00
committed by GitHub
11 changed files with 34 additions and 27 deletions

View File

@@ -281,7 +281,7 @@ class BlendSearch(Searcher):
self._start_time = now
self._set_deadline()
if self._input_cost_attr == "auto":
self.cost_attr = TIME_TOTAL_S
self.cost_attr = self._ls.cost_attr = TIME_TOTAL_S
if "metric_target" in spec:
self._metric_target = spec.get("metric_target")
if "num_samples" in spec:
@@ -820,22 +820,29 @@ class BlendSearch(Searcher):
def _select_thread(self) -> Tuple:
"""thread selector; use can_suggest to check LS availability"""
# update priority
now = time.time()
min_eci = self._deadline - now
if min_eci <= 0:
# return -1, -1
# keep proposing new configs assuming no budget left
min_eci = 0
# calculate min_eci according to the budget left
min_eci = np.inf
if self.cost_attr == TIME_TOTAL_S:
now = time.time()
min_eci = self._deadline - now
if min_eci <= 0:
# return -1, -1
# keep proposing new configs assuming no budget left
min_eci = 0
elif self._num_samples and self._num_samples > 0:
# estimate time left according to num_samples limitation
num_finished = len(self._result)
num_proposed = num_finished + len(self._trial_proposed_by)
num_left = max(self._num_samples - num_proposed, 0)
if num_proposed > 0:
time_used = now - self._start_time + self._time_used
min_eci = min(min_eci, time_used / num_finished * num_left)
# print(f"{min_eci}, {time_used / num_finished * num_left}, {num_finished}, {num_left}")
elif self._num_samples and self._num_samples > 0:
# estimate time left according to num_samples limitation
num_finished = len(self._result)
num_proposed = num_finished + len(self._trial_proposed_by)
num_left = max(self._num_samples - num_proposed, 0)
if num_proposed > 0:
time_used = now - self._start_time + self._time_used
min_eci = min(min_eci, time_used / num_finished * num_left)
# print(f"{min_eci}, {time_used / num_finished * num_left}, {num_finished}, {num_left}")
min_eci = max(self._num_samples - num_proposed, 0)
# update priority
max_speed = 0
for thread in self._search_thread_pool.values():
if thread.speed > max_speed:

View File

@@ -38,10 +38,10 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install flaml[notebook];\n",
"%pip install flaml[notebook]\n",
"# from v0.6.6, catboost is made an optional dependency to build conda package.\n",
"# to install catboost without installing the notebook option, you can run:\n",
"# !pip install flaml[catboost]"
"# %pip install flaml[catboost]"
]
},
{

View File

@@ -39,7 +39,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install flaml[notebook];"
"%pip install flaml[notebook]"
]
},
{
@@ -569,7 +569,7 @@
"metadata": {},
"outputs": [],
"source": [
"# !pip install optuna==2.8.0;"
"# %pip install optuna==2.8.0"
]
},
{

View File

@@ -192,7 +192,7 @@
}
],
"source": [
"!pip install flaml[nlp,ray,notebook,blendsearch];"
"%pip install flaml[nlp,ray,notebook,blendsearch]"
]
},
{

View File

@@ -39,7 +39,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install flaml[notebook];"
"%pip install flaml[notebook]"
]
},
{

View File

@@ -31,7 +31,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install flaml[notebook,vw];"
"%pip install flaml[notebook,vw]"
]
},
{

View File

@@ -39,7 +39,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install flaml[azureml]"
"%pip install flaml[azureml]"
]
},
{

View File

@@ -78,7 +78,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install flaml[notebook];"
"%pip install flaml[notebook]"
]
},
{

View File

@@ -41,8 +41,8 @@
},
"outputs": [],
"source": [
"!pip install flaml[nlp]==0.7.1 # in higher version of flaml, the API for nlp tasks changed\n",
"!pip install transformers==3.4.0\n",
"%pip install flaml[nlp]==0.7.1 # in higher version of flaml, the API for nlp tasks changed\n",
"%pip install transformers==3.4.0\n",
"from flaml.nlp import AutoTransformers\n"
]
},

View File

@@ -17,7 +17,7 @@
},
"outputs": [],
"source": [
"#!pip install torch transformers datasets ipywidgets flaml[blendsearch,ray];"
"# %pip install torch transformers datasets ipywidgets flaml[blendsearch,ray]"
]
},
{

View File

@@ -18,7 +18,7 @@
},
"outputs": [],
"source": [
"!pip install torchvision flaml[blendsearch,ray];"
"%pip install torchvision flaml[blendsearch,ray]"
]
},
{