Deprecate OptimizationConfig.__init__(objective=), remove setter & clone_with_args(objective=) (#5151)#5151
Open
saitcakmak wants to merge 2 commits intofacebook:mainfrom
Open
Deprecate OptimizationConfig.__init__(objective=), remove setter & clone_with_args(objective=) (#5151)#5151saitcakmak wants to merge 2 commits intofacebook:mainfrom
saitcakmak wants to merge 2 commits intofacebook:mainfrom
Conversation
|
@saitcakmak has exported this pull request. If you are a Meta employee, you can view the originating Diff in D99491494. |
Summary: Part of the Restrict Objective to Single/Scalarized & Simplify OptimizationConfig design (see design doc: https://docs.google.com/document/d/1EGQYmBjiNGtYapXu1RLHEBdA5Yz2c7q17acX3es0yV8/edit). This is Diff 1 of the stack: enables the new `OptimizationConfig(objectives=[...])` construction path without breaking any existing code. Changes: - `OptimizationConfig.__init__` and `clone_with_args` are now keyword-only across `OptimizationConfig`, `MOOC`, and `PreferenceOptimizationConfig`. All positional callers updated. - New kwarg `objectives: list[Objective] | None = None`, mutually exclusive with `objective`, on both `__init__` and `clone_with_args`. - Internally stores `self._objectives: list[Objective]` (both paths). - New `objectives` property returns the list. - `objective` property raises `UnsupportedError` if `len > 1`. - `is_moo_problem` property: True when multiple objectives or legacy multi-objective expression. - `metric_names`, `metric_name_to_signature`, `metric_signatures` aggregate across all objectives + constraints. - `__repr__` always uses `objectives=`. - JSON storage: encoder uses `objectives` key; decoder has backward compat to convert old `objective` key to `objectives` list. - SQA storage: encoder iterates `objectives` to encode each one; decoder collects multiple OBJECTIVE rows and reconstructs `OptimizationConfig(objectives=...)` when `len > 1`. - Validation ensures no duplicate metrics across objectives and no multi-objective expressions in individual list elements. Differential Revision: D99387020
…one_with_args(objective=) (facebook#5151) Summary: Goal: We added `objectives` input, we're now migrating all usage to `objectives` and eliminating the `objective` input. This will make it easier to eliminate `MultiObjective` and `MultiObjectiveOptimizationConfig`. Phase 1 of the OptimizationConfig simplification migration: - Add DeprecationWarning when passing objective= to OptimizationConfig.__init__ - Remove the objective setter on OptimizationConfig (MOOC keeps its own) - Remove objective= param from OptimizationConfig.clone_with_args (MOOC/PreferenceOC keep theirs) - Migrate all callers of the removed setter and clone_with_args(objective=) Differential Revision: D99491494
da31f0e to
7e4a99f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5151 +/- ##
==========================================
+ Coverage 96.39% 96.40% +0.01%
==========================================
Files 613 613
Lines 68385 68493 +108
==========================================
+ Hits 65919 66031 +112
+ Misses 2466 2462 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Goal: We added
objectivesinput, we're now migrating all usage toobjectivesand eliminating theobjectiveinput. This will make it easier to eliminateMultiObjectiveandMultiObjectiveOptimizationConfig.Phase 1 of the OptimizationConfig simplification migration:
Differential Revision: D99491494