Commit 75c0ed4
Prefer predictive adapter over fallback in GenerationNode._fitted_adapter (#5199)
Summary:
Pull Request resolved: #5199
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
fbshipit-source-id: 30821af699806be50c5af88589b9209080c588011 parent bbb0d71 commit 75c0ed4
2 files changed
Lines changed: 53 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
352 | 359 | | |
353 | 360 | | |
354 | 361 | | |
355 | 362 | | |
356 | | - | |
| 363 | + | |
357 | 364 | | |
358 | 365 | | |
359 | 366 | | |
360 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
361 | 378 | | |
362 | 379 | | |
363 | 380 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
288 | 323 | | |
289 | 324 | | |
290 | 325 | | |
| |||
0 commit comments