-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to Adapter constructors, require experiment #3415
base: main
Are you sure you want to change the base?
Conversation
This pull request was exported from Phabricator. Differential Revision: D70103442 |
This pull request was exported from Phabricator. Differential Revision: D70103442 |
Summary: Pull Request resolved: facebook#3415 The motivation for this change is to bring us closer to relying on the `experiment` as the source of truth about the experiment state & attributes within the modeling layer. We currently support many inputs that are extracted from the `experiment`, just to be passed in alongside it. By making `experiment` a required input, we open the possibility of removing these extra inputs and extracting them directly from `experiment` where they're needed. Makes the following changes to Adapter constructors: - Requires keyword-only arguments. Positional inputs are no-longer supported. - Makes `experiment` required and `search_space` optional. - Re-orders inputs for consistency across sub-classes. In addition: - Removes `model` input to `Adapter._fit`. This is a private method that is only called through `fit_if_implemented` (with `self.model`). Accepting multiple inputs for the same argument only makes the code harder to reason about. - Removes class level attributes, some of which weren't initialized in `__init__`, leading to pyre complaints. All attributes are now initialized in `__init__`. This also eliminates misleading "optional" type hints with `None` default for `model`, which is never `None` in practice. - Removes `Adapter.update`, which has been deprecated for quite some time. - Initializing a Generator from registry with only `search_space` is being deprecated. It is temporarily supported using a dummy experiment for random & discrete adapters, which previously did not require an `experiment`. Differential Revision: D70103442
9d4472e
to
adfa3d8
Compare
Summary: The motivation for this change is to bring us closer to relying on the `experiment` as the source of truth about the experiment state & attributes within the modeling layer. We currently support many inputs that are extracted from the `experiment`, just to be passed in alongside it. By making `experiment` a required input, we open the possibility of removing these extra inputs and extracting them directly from `experiment` where they're needed. Makes the following changes to Adapter constructors: - Requires keyword-only arguments. Positional inputs are no-longer supported. - Makes `experiment` required and `search_space` optional. - Re-orders inputs for consistency across sub-classes. In addition: - Removes `model` input to `Adapter._fit`. This is a private method that is only called through `fit_if_implemented` (with `self.model`). Accepting multiple inputs for the same argument only makes the code harder to reason about. - Removes class level attributes, some of which weren't initialized in `__init__`, leading to pyre complaints. All attributes are now initialized in `__init__`. This also eliminates misleading "optional" type hints with `None` default for `model`, which is never `None` in practice. - Removes `Adapter.update`, which has been deprecated for quite some time. - Initializing a Generator from registry with only `search_space` is being deprecated. It is temporarily supported using a dummy experiment for random & discrete adapters, which previously did not require an `experiment`. Differential Revision: D70103442
adfa3d8
to
c0c9dba
Compare
This pull request was exported from Phabricator. Differential Revision: D70103442 |
Summary: The motivation for this change is to bring us closer to relying on the `experiment` as the source of truth about the experiment state & attributes within the modeling layer. We currently support many inputs that are extracted from the `experiment`, just to be passed in alongside it. By making `experiment` a required input, we open the possibility of removing these extra inputs and extracting them directly from `experiment` where they're needed. Makes the following changes to Adapter constructors: - Requires keyword-only arguments. Positional inputs are no-longer supported. - Makes `experiment` required and `search_space` optional. - Re-orders inputs for consistency across sub-classes. In addition: - Removes `model` input to `Adapter._fit`. This is a private method that is only called through `fit_if_implemented` (with `self.model`). Accepting multiple inputs for the same argument only makes the code harder to reason about. - Removes class level attributes, some of which weren't initialized in `__init__`, leading to pyre complaints. All attributes are now initialized in `__init__`. This also eliminates misleading "optional" type hints with `None` default for `model`, which is never `None` in practice. - Removes `Adapter.update`, which has been deprecated for quite some time. - Initializing a Generator from registry with only `search_space` is being deprecated. It is temporarily supported using a dummy experiment for random & discrete adapters, which previously did not require an `experiment`. Differential Revision: D70103442
c0c9dba
to
6445681
Compare
This pull request was exported from Phabricator. Differential Revision: D70103442 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3415 +/- ##
==========================================
- Coverage 95.99% 95.99% -0.01%
==========================================
Files 539 539
Lines 52794 52800 +6
==========================================
+ Hits 50679 50683 +4
- Misses 2115 2117 +2 ☔ View full report in Codecov by Sentry. |
Summary:
The motivation for this change is to bring us closer to relying on the
experiment
as the source of truth about the experiment state & attributes within the modeling layer. We currently support many inputs that are extracted from theexperiment
, just to be passed in alongside it. By makingexperiment
a required input, we open the possibility of removing these extra inputs and extracting them directly fromexperiment
where they're needed.Makes the following changes to Adapter constructors:
experiment
required andsearch_space
optional.In addition:
model
input toAdapter._fit
. This is a private method that is only called throughfit_if_implemented
(withself.model
). Accepting multiple inputs for the same argument only makes the code harder to reason about.__init__
, leading to pyre complaints. All attributes are now initialized in__init__
. This also eliminates misleading "optional" type hints withNone
default formodel
, which is neverNone
in practice.Adapter.update
, which has been deprecated for quite some time.search_space
is being deprecated. It is temporarily supported using a dummy experiment for random & discrete adapters, which previously did not require anexperiment
.Differential Revision: D70103442