Prefer predictive adapter over fallback in GenerationNode._fitted_adapter#5199
Closed
andycylmeta wants to merge 1 commit into
Closed
Prefer predictive adapter over fallback in GenerationNode._fitted_adapter#5199andycylmeta wants to merge 1 commit into
andycylmeta wants to merge 1 commit into
Conversation
…pter Summary: When BoTorch candidate generation fails after MAX_GEN_ATTEMPTS (e.g. due to search space exhaustion), the generation node falls back to Sobol for that particular gen call. This fallback overwrites `_generator_spec_to_gen_from` with a RandomAdapter, which cannot make predictions. The problem is that downstream analysis code reads `GenerationStrategy.adapter` to generate model-dependent plots (cross-validation, sensitivity, surface, modeled arm effects, etc.). Since the adapter now points to the Sobol fallback's RandomAdapter, all these analyses fail with "does not support predictions" or "TorchAdapter is required" errors -- even though the original fitted TorchAdapter is still preserved on the generator spec. This diff fixes `GenerationNode._fitted_adapter` to check: if the current adapter cannot predict, look for a fitted predictive adapter among the original `generator_specs` and prefer that instead. This is safe because the original TorchAdapter is never destroyed by the fallback -- it's just shadowed by the `_generator_spec_to_gen_from` override. Reviewed By: ItsMrLin Differential Revision: D99358260
|
@andycylmeta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D99358260. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5199 +/- ##
==========================================
- Coverage 96.39% 96.38% -0.01%
==========================================
Files 617 617
Lines 69476 69494 +18
==========================================
+ Hits 66972 66985 +13
- Misses 2504 2509 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This pull request has been merged in 75c0ed4. |
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:
When BoTorch candidate generation fails after MAX_GEN_ATTEMPTS (e.g. due to
search space exhaustion), the generation node falls back to Sobol for that
particular gen call. This fallback overwrites
_generator_spec_to_gen_fromwith a RandomAdapter, which cannot make predictions.
The problem is that downstream analysis code reads
GenerationStrategy.adapterto generate model-dependentplots (cross-validation, sensitivity, surface, modeled arm effects, etc.).
Since the adapter now points to the Sobol fallback's RandomAdapter, all these
analyses fail with "does not support predictions" or "TorchAdapter is required"
errors -- even though the original fitted TorchAdapter is still preserved on
the generator spec.
This diff fixes
GenerationNode._fitted_adapterto check: if the currentadapter cannot predict, look for a fitted predictive adapter among the
original
generator_specsand prefer that instead. This is safe because theoriginal TorchAdapter is never destroyed by the fallback -- it's just
shadowed by the
_generator_spec_to_gen_fromoverride.Reviewed By: ItsMrLin
Differential Revision: D99358260