Skip to content

Commit

Permalink
Allow -1 generation step index (#1342)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #1342

Reviewed By: bernardbeckerman

Differential Revision: D42252297

fbshipit-source-id: 38305b09817fafa6508e5f0edfd3e563c721677b
  • Loading branch information
Lena Kashtelyan authored and facebook-github-bot committed Dec 28, 2022
1 parent bf197a7 commit 5e61497
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ax/core/generator_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ def __init__(
rather than to reproduce the conditions, in which this generator
run was created.
generation_step_index: Optional index of the generation step that produced
this generator run. Applicable only if the genetator run was created
via a generation strategy.
this generator run. Applicable only if the generator run was created
via a generation strategy (in which case this index should reflect the
index of generation step in a generation strategy) or a standalone
generation step (in which case this index should be ``-1``).
candidate_metadata_by_arm_signature: Optional dictionary of arm signatures
to model-produced candidate metadata that corresponds to that arm in
this generator run.
Expand Down Expand Up @@ -193,8 +195,14 @@ def __init__(
)
self._candidate_metadata_by_arm_signature = candidate_metadata_by_arm_signature

# Validate that generation step index is non-negative.
assert generation_step_index is None or generation_step_index >= 0
# Validate that generation step index is either not set (not from generation
# strategy or ste), is non-negative (from generation step) or is -1 (from a
# standalone generation step that was not a part of a generation strategy).
assert (
generation_step_index is None # Not generation strategy/step
or generation_step_index == -1 # Standalone generation step
or generation_step_index >= 0 # Generation strategy
)
self._generation_step_index = generation_step_index

@property
Expand Down

0 comments on commit 5e61497

Please sign in to comment.