Skip to content
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

Warn if inoperable keyword arguments are passed to optimizers #1677

Closed
wants to merge 2 commits into from

Conversation

esantorella
Copy link
Member

Summary: The previous diff discusses issues with kwargs in BoTorch optimizers and resolves some of them. This diff warns if keyword arguments that do nothing are passed to an optimizer, and stops Ax (botorch-modular) from doing that.

Differential Revision: D43277102

@facebook-github-bot facebook-github-bot added CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported labels Feb 14, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D43277102

@codecov
Copy link

codecov bot commented Feb 14, 2023

Codecov Report

Merging #1677 (61cb668) into main (ad38736) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 61cb668 differs from pull request most recent head c728104. Consider uploading reports for the commit c728104 to get more accurate results

@@            Coverage Diff            @@
##              main     #1677   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          169       169           
  Lines        14517     14523    +6     
=========================================
+ Hits         14517     14523    +6     
Impacted Files Coverage Δ
botorch/optim/initializers.py 100.00% <100.00%> (ø)
botorch/optim/optimize.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

esantorella and others added 2 commits February 14, 2023 13:24
Summary:
Pull Request resolved: pytorch#1676

The usage of `kwargs` in `optimize_acqf` and related functions has a few downsides:
- It's not transparent to the user what options are supported
- When kwargs get mutated by `.pop()`, this can cause subtle errors
- If a user provides an unsupported option, there will be no error or warning.

In this diff I change some options in `kwargs` to named arguments. I did not entirely remove `kwargs`, because they serve a few purposes, all of which are kind of iffy. I'll attack that in the next diff in the stack. These purposes are:

- Some kwargs, now marked as `ic_gen_kwargs`, get passed from `optimize_acqf` to a function that generates ICs. This will only happen if the user provides a function with a different signature from the BoTorch IC generator functions. I'm not sure anyone was actually using that functionality. Tests still pass if the `kwargs` arguement in `optimize_acqf` is removed.
- Users may pass incorrect keyword arguments for no good reason. This fails silently.
- Ax `botorch_modular` passes the same signature to a variety of optimizers when the user does not specify otherwise. So it passes keyword arguments that don't do anything, but for a good reason. I think it would make sense to have BoTorch raise a warning and Ax silence it.

Differential Revision: https://internalfb.com/D43200823

fbshipit-source-id: b66ac13dba40ccd9e0b2c4e3ef10475d9b3a8167
…h#1421)

Summary:
X-link: facebook/Ax#1421

Pull Request resolved: pytorch#1677

The previous diff discusses issues with kwargs in BoTorch optimizers and resolves some of them. This diff warns if keyword arguments that do nothing are passed to an optimizer, and stops Ax (botorch-modular) from doing that.

Reviewed By: lena-kashtelyan

Differential Revision: D43277102

fbshipit-source-id: f22b4cd1c4b6227a5210f27d1501c3667209a1d7
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D43277102

esantorella added a commit to esantorella/Ax that referenced this pull request Feb 14, 2023
…ok#1421)

Summary:
Pull Request resolved: facebook#1421

X-link: pytorch/botorch#1677

The previous diff discusses issues with kwargs in BoTorch optimizers and resolves some of them. This diff warns if keyword arguments that do nothing are passed to an optimizer, and stops Ax (botorch-modular) from doing that.

Reviewed By: lena-kashtelyan

Differential Revision: D43277102

fbshipit-source-id: e3a473ef47018e32b8432332033110db06b006be
facebook-github-bot pushed a commit to facebook/Ax that referenced this pull request Feb 16, 2023
Summary:
Pull Request resolved: #1421

X-link: pytorch/botorch#1677

The previous diff discusses issues with kwargs in BoTorch optimizers and resolves some of them. This diff warns if keyword arguments that do nothing are passed to an optimizer, and stops Ax (botorch-modular) from doing that.

Reviewed By: lena-kashtelyan

Differential Revision: D43277102

fbshipit-source-id: b31ef580223fd9d8596a9c69ac4035cbd9e8f3ef
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 6940b53.

facebook-github-bot pushed a commit that referenced this pull request Jun 26, 2024
Summary:
## Motivation

This code was deprecated somewhere between 0.8.0 and 0.9.0; as we are now past 0.11.0, it can be reaped.

Pull Request resolved: #2390

Test Plan:
Existing units, including tutorials.

## Related PRs

#1677

Reviewed By: Balandat

Differential Revision: D58930631

Pulled By: esantorella

fbshipit-source-id: fc6c3900baa53fa8d04299a1e398f23aa1f3aa53
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 Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants