Skip to content

Commit d2cd55f

Browse files
mgarrardfacebook-github-bot
authored andcommitted
Remove fall-back to list (#2353)
Summary: Pull Request resolved: #2353 Based on a recent discussion with the team, we decided to remove this special casing while we finalize GenerationNodes to make development a bit cleaner. Reviewed By: lena-kashtelyan Differential Revision: D55001898 fbshipit-source-id: 0c6b5a4b5ceb1caa619314347aa8a2bfd6124dea
1 parent 1e14812 commit d2cd55f

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

ax/modelbridge/generation_node.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,9 @@ def should_transition_to_next_node(
439439
raise NotImplementedError(
440440
"Cannot currently select between multiple nodes to transition to."
441441
)
442-
elif len(next_nodes) == 1:
443-
return True, next_nodes[0]
444442
else:
445-
# Will transition to the next node in the list.
446-
return True, None
443+
return True, next_nodes[0]
444+
447445
return False, None
448446

449447
def generator_run_limit(self, supress_generation_errors: bool = True) -> int:

ax/modelbridge/tests/test_generation_strategy.py

+2
Original file line numberDiff line numberDiff line change
@@ -1284,12 +1284,14 @@ def test_gs_with_nodes_and_blocking_criteria(self) -> None:
12841284
threshold=3,
12851285
block_gen_if_met=True,
12861286
block_transition_if_unmet=True,
1287+
transition_to="GPEI_node",
12871288
),
12881289
MinTrials(
12891290
threshold=2,
12901291
only_in_statuses=[TrialStatus.COMPLETED],
12911292
block_gen_if_met=False,
12921293
block_transition_if_unmet=True,
1294+
transition_to="GPEI_node",
12931295
),
12941296
],
12951297
)

tutorials/external_generation_node.ipynb

+3-1
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,11 @@
223223
" model_specs=[ModelSpec(Models.SOBOL)],\n",
224224
" transition_criteria=[\n",
225225
" MaxTrials(\n",
226-
" # This specifies the maximum number of trials to generate from this node.\n",
226+
" # This specifies the maximum number of trials to generate from this node, \n",
227+
" # and the next node in the strategy.\n",
227228
" threshold=5,\n",
228229
" block_transition_if_unmet=True,\n",
230+
" transition_to=\"RandomForest\"\n",
229231
" )\n",
230232
" ],\n",
231233
" ),\n",

0 commit comments

Comments
 (0)