-
Notifications
You must be signed in to change notification settings - Fork 415
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
Add a minimize_with_timeout wrapper for scipy.optimize.minimize #1403
Conversation
This pull request was exported from Phabricator. Differential Revision: D39529835 |
Codecov Report
@@ Coverage Diff @@
## main #1403 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 153 154 +1
Lines 13686 13730 +44
=========================================
+ Hits 13686 13730 +44
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` setting in the `options` dict, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: 6caced5e689a79231699025a50f76fb69cfecb20
f1e33c3
to
dfad6ca
Compare
This pull request was exported from Phabricator. Differential Revision: D39529835 |
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` setting in the `options` dict, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: 71fa5eabbb3f073e32796d9d3d451b6786ef3a2d
dfad6ca
to
a06ecaa
Compare
This pull request was exported from Phabricator. Differential Revision: D39529835 |
1 similar comment
This pull request was exported from Phabricator. Differential Revision: D39529835 |
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` kwarg, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: 27232f43dae509e5415ad412f6c21af16be49ff4
a06ecaa
to
e6f0f9f
Compare
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` kwarg, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: 5921cd81f00033d47df39f3ab2c47d9448952356
e6f0f9f
to
37dcd77
Compare
This pull request was exported from Phabricator. Differential Revision: D39529835 |
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` kwarg, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: db1464963e6d04b6b1f68835099b44f9fc442d6b
37dcd77
to
1602eb4
Compare
This pull request was exported from Phabricator. Differential Revision: D39529835 |
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` kwarg, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: ce5bde193cc63ca4ed9a0a8f2b8cc3110a116640
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` kwarg, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: 4f54079fc395d9b1ec7e88edbdb2962ce36231f3
1602eb4
to
f3cb4eb
Compare
This pull request was exported from Phabricator. Differential Revision: D39529835 |
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` kwarg, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: adc79a40f1cfeebed4a5706ec4eea71691ea4619
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` kwarg, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: 985ad2c06abf4c7326aeed6b29aa196b5d4b2a97
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` kwarg, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: 50f773bfa2fb5b50ab9c6d724d6fc4a67e4f6a6e
…rch#1403) Summary: Pull Request resolved: pytorch#1403 Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around `scipy.optimize.minimize` to achieve this. The new `minimize_with_timeout` method calls `scipy.optimize.minimize` with all arguments forwarded verbatim. The only difference is that if provided a `timeout_sec` kwarg, it automatically stops the optimization after the timeout is reached. Internally, this is achieved by automatically constructing a callback method that is injected to the `scipy.optimize.minimize` call that keeps track of the runtime and is used to extract the value of the optimization variables at the current iteration. Differential Revision: D39529835 fbshipit-source-id: f3f6c9654f0ea1a348610428ca5b01e8ef3d78ef
This pull request has been merged in b885609. |
Summary:
Unfortunately, scipy does not allow timing out the optimization based on wall time. This diff implements a lightweight wrapper around
scipy.optimize.minimize
to achieve this.The new
minimize_with_timeout
method callsscipy.optimize.minimize
with all arguments forwarded verbatim. The only difference is that if provided atimeout_sec
setting in theoptions
dict, it automatically stops the optimization after the timeout is reached.Internally, this is achieved by automatically constructing a callback method that is injected to the
scipy.optimize.minimize
call that keeps track of the runtime and is used to extract the value of the optimization variables atthe current iteration.
Differential Revision: D39529835