Skip to content

Split into FullyBayesianMultiTaskGP + SaasFullyBayesianMultiTaskGP, generalize to accept any PyroModel#3180

Open
hvarfner wants to merge 1 commit into
meta-pytorch:mainfrom
hvarfner:export-D93037430
Open

Split into FullyBayesianMultiTaskGP + SaasFullyBayesianMultiTaskGP, generalize to accept any PyroModel#3180
hvarfner wants to merge 1 commit into
meta-pytorch:mainfrom
hvarfner:export-D93037430

Conversation

@hvarfner
Copy link
Copy Markdown
Contributor

Summary:
Corresponds to D92844565. This diff also absorbs the 'generalize GP to accept any PyroModel' work from the now-dropped D92844566.

(1) Rename the current SaasFullyBayesianMultiTaskGPFullyBayesianMultiTaskGP (public name from the start, no private-then-rename dance).

(2) Create SaasFullyBayesianMultiTaskGP(FullyBayesianMultiTaskGP) that defaults pyro_model=MultitaskSaasPyroModel().

(3) Widen pyro_model type to PyroModel, validate is_multitask at construction time: if not pyro_model.is_multitask: raise ValueError(...) — the one appropriate use of is_multitask (type guard at construction time).

(4) Replace hardcoded dummy samples in load_state_dict with pyro_model.get_dummy_mcmc_samples() — zero hardcoded keys.

(5) Base class raises ValueError if pyro_model is None. SaasFullyBayesianMultiTaskGP sets the default.

Files to modify:

  • fbcode/pytorch/botorch/botorch/models/fully_bayesian_multitask.py — split class, widen types, delegate load_state_dict
  • fbcode/pytorch/botorch/test/models/test_fully_bayesian_multitask.py — test base with explicit PyroModel, test is_multitask validation, test MaternPyroModel-based MT model

MANDATORY CODING STANDARDS (apply to every line of code in this diff):

  1. SELF-CONTAINED DIFFS: Every diff must be entirely self-contained. Every line of production code introduced in this diff MUST be covered by tests that are introduced in the SAME diff. Never create code without its corresponding tests, and never create tests in a separate diff from the code they cover.

  2. NO TRY/EXCEPT: Do NOT use try/except statements anywhere, under any circumstances. Handle errors through proper control flow, type checking, validation, and return values instead. If existing code uses try/except, that is okay - it does not need to be changed.

  3. NO DUPLICATE CODE: Aggressively eliminate duplicate code. Extract shared logic into helper functions, base classes, or utilities. When you believe this item is complete, launch a subagent whose sole job is to audit the diff for duplicate code and refactor it away before finalizing.

  4. SIMPLEST REUSABLE SOLUTION: Always choose the simplest, most reusable solution. Prefer composition over inheritance, small focused functions over large ones, and generic utilities over one-off implementations. However, do not excessively use thin wrapper functions, as these unnecessarily increase the number of lines of code.

  5. CONCISE DIFF SUMMARY: The diff summary must explain WHY the change is implemented, not enumerate methods added. The summary must be at most three precise sentences describing the functionality and motivation. If it is longer than three sentences, you must shorten the summary.

Differential Revision: D93037430

@meta-cla meta-cla Bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Feb 12, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Feb 12, 2026

@hvarfner has exported this pull request. If you are a Meta employee, you can view the originating Diff in D93037430.

hvarfner pushed a commit to hvarfner/botorch that referenced this pull request Feb 12, 2026
…eneralize to accept any PyroModel (meta-pytorch#3180)

Summary:

Corresponds to D92844565. This diff also absorbs the 'generalize GP to accept any PyroModel' work from the now-dropped D92844566.

(1) Rename the current `SaasFullyBayesianMultiTaskGP` → `FullyBayesianMultiTaskGP` (public name from the start, no private-then-rename dance).

(2) Create `SaasFullyBayesianMultiTaskGP(FullyBayesianMultiTaskGP)` that defaults `pyro_model=MultitaskSaasPyroModel()`.

(3) Widen `pyro_model` type to `PyroModel`, validate `is_multitask` at construction time: `if not pyro_model.is_multitask: raise ValueError(...)` — the one appropriate use of `is_multitask` (type guard at construction time).

(4) Replace hardcoded dummy samples in `load_state_dict` with `pyro_model.get_dummy_mcmc_samples()` — zero hardcoded keys.

(5) Base class raises `ValueError` if `pyro_model is None`. `SaasFullyBayesianMultiTaskGP` sets the default.

Files to modify:
- `fbcode/pytorch/botorch/botorch/models/fully_bayesian_multitask.py` — split class, widen types, delegate load_state_dict
- `fbcode/pytorch/botorch/test/models/test_fully_bayesian_multitask.py` — test base with explicit PyroModel, test is_multitask validation, test MaternPyroModel-based MT model

MANDATORY CODING STANDARDS (apply to every line of code in this diff):

1. SELF-CONTAINED DIFFS: Every diff must be entirely self-contained. Every line of production code introduced in this diff MUST be covered by tests that are introduced in the SAME diff. Never create code without its corresponding tests, and never create tests in a separate diff from the code they cover.

2. NO TRY/EXCEPT: Do NOT use try/except statements anywhere, under any circumstances. Handle errors through proper control flow, type checking, validation, and return values instead. If existing code uses try/except, that is okay - it does not need to be changed.

3. NO DUPLICATE CODE: Aggressively eliminate duplicate code. Extract shared logic into helper functions, base classes, or utilities. When you believe this item is complete, launch a subagent whose sole job is to audit the diff for duplicate code and refactor it away before finalizing.

4. SIMPLEST REUSABLE SOLUTION: Always choose the simplest, most reusable solution. Prefer composition over inheritance, small focused functions over large ones, and generic utilities over one-off implementations. However, do not excessively use thin wrapper functions, as these unnecessarily increase the number of lines of code.

5. CONCISE DIFF SUMMARY: The diff summary must explain WHY the change is implemented, not enumerate methods added. The summary must be at most three precise sentences describing the functionality and motivation. If it is longer than three sentences, you must shorten the summary.

Differential Revision: D93037430
hvarfner pushed a commit to hvarfner/botorch that referenced this pull request Feb 12, 2026
Summary:

Create generic FullyBayesianMultiTaskGP, make Saas variant special case

Differential Revision: D93037430
hvarfner pushed a commit to hvarfner/botorch that referenced this pull request Feb 12, 2026
Summary:

Create generic FullyBayesianMultiTaskGP, make Saas variant special case

Differential Revision: D93037430
@hvarfner hvarfner closed this Feb 12, 2026
@hvarfner hvarfner reopened this Feb 12, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.99%. Comparing base (9f269fa) to head (6d5204a).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3180   +/-   ##
=======================================
  Coverage   99.99%   99.99%           
=======================================
  Files         219      219           
  Lines       21414    21416    +2     
=======================================
+ Hits        21413    21415    +2     
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

hvarfner pushed a commit to hvarfner/botorch that referenced this pull request Feb 13, 2026
Summary:

Creates generic FullyBayesianMultiTaskGP implementation and refactors the existing SAAS model as a special case

Differential Revision: D93037430
hvarfner pushed a commit to hvarfner/botorch that referenced this pull request Feb 13, 2026
Summary:

Creates generic FullyBayesianMultiTaskGP implementation and refactors the existing SAAS model as a special case

Differential Revision: D93037430
Summary:

Creates generic FullyBayesianMultiTaskGP implementation and refactors the existing SAAS model as a special case

Reviewed By: saitcakmak

Differential Revision: D93037430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant