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

Patch for Xopt 2.5.4 #144

Merged
merged 6 commits into from
Feb 20, 2025
Merged

Patch for Xopt 2.5.4 #144

merged 6 commits into from
Feb 20, 2025

Conversation

wenatuhs
Copy link
Collaborator

  • Use Xopt's default sanity check when compose routine
  • Attempt to use TuRBO's reset method to clean up fields before starting a new run
  • Move variable bound check into base env class, raise error if check fails to pass

@@ -91,6 +91,11 @@ def run_routine_subprocess(
# set required arguments
try:
routine = load_run(args["routine_filename"])
# Call the reset generator API before starting the optimization
try:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using try/except, can we use an isinstance (routine.generator, BayesianGenerator) which would be more stable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for our current application/code the two approaches would perform exactly the same. If we add in more generators with state in Xopt in the future I feel we might need more general reset() API, in that case it could be easier to just write try except blocks...

I'm of course open to further discussion, it would be great if you can show me an example where the isinstance approach is better than the try catch one, then we can change the code accordingly :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no generators outside Bayesian ones that are likely to use the same turbo controller type. There are many possible ways inside calling the turbo controller that could raise an Attribute error which in turn would fail silently due to the try except block.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't want things to fail silently

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see! Thanks for the explanation/example! That makes sense. So we don't want the potential internal Attribute errors to be ignored when we call turbo_controller.reset(). Will do the isinstance logic once the reset API works.

try:
bound = self.get_bound(name)
except Exception:
raise BadgerEnvVarError(f"Failed to get bound for {name}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this puts up a warning box in the GUI correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right -- any issues raised during an action through GUI would result in a warning box (implemented by Shamin) :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great thx

Will add back and use it to reset generator stats once it's working
@wenatuhs wenatuhs merged commit 132fc41 into main Feb 20, 2025
10 checks passed
@wenatuhs wenatuhs deleted the xopt-patch branch February 20, 2025 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants