Skip to content

Commit

Permalink
fix various spelling errors in gs stack
Browse files Browse the repository at this point in the history
Summary: Installed a spell checker and fixed all remaining spelling errors in generation strategy files (gs, generation node, tests, transition criterion)

Differential Revision: D57175357
  • Loading branch information
mgarrard authored and facebook-github-bot committed May 9, 2024
1 parent 6a12264 commit 0b07a3e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions ax/modelbridge/generation_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class GenerationStrategy(GenerationStrategyInterface):
should use nodes. Notably, either, but not both, of `nodes` and `steps`
must be provided.
steps: A list of `GenerationStep` describing steps of this strategy.
name: An optional name for this generaiton strategy. If not specified,
name: An optional name for this generation strategy. If not specified,
strategy's name will be names of its nodes' models joined with '+'.
"""

Expand Down Expand Up @@ -526,9 +526,9 @@ def _validate_and_set_step_sequence(self, steps: List[GenerationStep]) -> None:
This function validates:
1. That only the last step has num_trials=-1, which indicates unlimited
trial generation is possible.
2. That each step's num_trials attrivute is either positive or -1
2. That each step's num_trials attribute is either positive or -1
3. That each step's max_parallelism attribute is either None or positive
It then sets the corect TransitionCriterion and node_name attributes on the
It then sets the correct TransitionCriterion and node_name attributes on the
underlying GenerationNode objects.
"""
for idx, step in enumerate(steps):
Expand All @@ -537,8 +537,8 @@ def _validate_and_set_step_sequence(self, steps: List[GenerationStep]) -> None:
raise UserInputError(
"Only last step in generation strategy can have "
"`num_trials` set to -1 to indicate that the model in "
"the step shouldbe used to generate new trials "
"indefinitely unless completion critera present."
"the step should be used to generate new trials "
"indefinitely unless completion criteria present."
)
elif step.num_trials < 1 and step.num_trials != -1:
raise UserInputError(
Expand Down Expand Up @@ -684,12 +684,12 @@ def _gen_multiple(
"""Produce multiple generator runs at once, to be made into multiple
trials on the experiment.
NOTE: This is used to ensure that maximum paralellism and number
NOTE: This is used to ensure that maximum parallelism and number
of trials per node are not violated when producing many generator
runs from this generation strategy in a row. Without this function,
if one generates multiple generator runs without first making any
of them into running trials, generation strategy cannot enforce that it only
produces as many generator runs as are allowed by the paralellism
produces as many generator runs as are allowed by the parallelism
limit and the limit on number of trials in current node.
Args:
Expand Down
10 changes: 5 additions & 5 deletions ax/modelbridge/tests/test_transition_criterion.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def setUp(self) -> None:
self.branin_experiment = get_branin_experiment()

def test_minimum_preference_criterion(self) -> None:
"""Tests the minimum preference criterion subcalss of TransitionCriterion."""
"""Tests the minimum preference criterion subclass of TransitionCriterion."""
criterion = MinimumPreferenceOccurances(metric_name="m1", threshold=3)
experiment = get_experiment()
generation_strategy = GenerationStrategy(
Expand Down Expand Up @@ -192,14 +192,14 @@ def test_min_trials_is_met(self) -> None:
for _i in range(4):
experiment.new_trial(gs.gen(experiment=experiment))

# TODO: @mgarrard More comphrensive test of trials_from_node
# TODO: @mgarrard More comprehensive test of trials_from_node
node_0_trials = gs._steps[0].trials_from_node
node_1_trials = gs._steps[1].trials_from_node

self.assertEqual(len(node_0_trials), 4)
self.assertEqual(len(node_1_trials), 0)

# MinTrials is met should not pass yet, becasue no trials
# MinTrials is met should not pass yet, because no trials
# are marked completed
self.assertFalse(
gs._steps[0]
Expand Down Expand Up @@ -450,11 +450,11 @@ def test_repr(self) -> None:
+ "'use_all_trials_in_exp': False, "
+ "'complete_trial_generation': True})",
)
minimum_preference_occurances_criterion = MinimumPreferenceOccurances(
minimum_preference_occurrences_criterion = MinimumPreferenceOccurances(
metric_name="m1", threshold=3
)
self.assertEqual(
str(minimum_preference_occurances_criterion),
str(minimum_preference_occurrences_criterion),
"MinimumPreferenceOccurances({'metric_name': 'm1', 'threshold': 3, "
+ "'transition_to': None, 'block_gen_if_met': False, "
"'block_transition_if_unmet': True})",
Expand Down
4 changes: 2 additions & 2 deletions ax/modelbridge/transition_criterion.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class TrialBasedCriterion(TransitionCriterion):
generate at most 3 trials, then the threshold is 3.
block_transition_if_unmet: A flag to prevent the node from completing and
being able to transition to another node. Ex: MaxGenerationParallelism
defaults to setting this to Flase since we can complete and move on from
defaults to setting this to False since we can complete and move on from
this node without ever reaching its threshold.
block_gen_if_met: A flag to prevent continued generation from the
associated GenerationNode if this criterion is met but other criterion
Expand Down Expand Up @@ -348,7 +348,7 @@ class MaxGenerationParallelism(TrialBasedCriterion):
are multiple arms per trial, and we enable generation of arms within a
batch from different ```GenerationNodes```. This flag should be set to
True for the last node in a set of ```GenerationNodes``` expected to
create a given ```BatchTrial```. Defautls to False for
create a given ```BatchTrial```. Defaults to False for
MaxGenerationParallelism since this criterion isn't currently used for
node -> node or trial -> trial transition.
"""
Expand Down

0 comments on commit 0b07a3e

Please sign in to comment.