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

Validate the configuration produced by LlamaTune inverse_transform() #806

Closed
wants to merge 12 commits into from

Conversation

motus
Copy link
Member

@motus motus commented Jul 18, 2024

Code to reproduce #805

@motus motus added bug Something isn't working ready for review Ready for review tests Add or fix unit tests mlos-core labels Jul 18, 2024
@bpkroth bpkroth linked an issue Jul 18, 2024 that may be closed by this pull request
Copy link
Contributor

Choose a reason for hiding this comment

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

Somewhat unrelated, we should add "quantization + llamatune" tests as well.

@@ -139,6 +139,8 @@ def inverse_transform(self, configurations: pd.DataFrame) -> pd.DataFrame:
self.target_parameter_space,
vector=target_config_vector,
)
self.target_parameter_space.check_configuration(target_config)
Copy link
Contributor

Choose a reason for hiding this comment

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

Might just need to clip them to the range in the case that it's too large (e.g., due to quantization issues).
Are there other failure cases than that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I took a slightly closer look at this.
max_unique_values_per_param is forcing the lower dimensions space to be UniformIntegerHyperparatmers, but the vector produced that is then dot producted with the approximate inverted matrix returns floats.

So, I think there's an additional scaling operation required to put that vector back into the max_unique_values_per_param range when that option is not None.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I've added the q_scaler inverse transform here as well, which makes the values look much better, but one is still out of bounds. I think it's maybe just needing clipping either there, or in a previous step.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

pytest -n0 mlos_bench/mlos_bench/tests/optimizers/llamatune_opt_test.py

to reproduce

motus and others added 4 commits July 22, 2024 14:05
These changes are mainly to add flexibility to the auth service in
supporting azure authenticating via:

- A personal identity via az CLI for the local dev environment. This
will still run into expiring issues, but is probably fine for local dev.
- A personal or managed identity in an azure hosted environment. The
flexibility to use the managed identity allows us to avoid the expiring
issue without needing a separate SP, key-vault and cert setup, aligning
with new security recommendations.

---------

Co-authored-by: Eu Jing Chua <eujingchua@microsoft.com>
Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
Mypy got updated to v 1.11 recently
We need these mypy fixes to make other PRs pass the CI tests
Closes microsoft#785 

Also, add more unit tests to make sure the optimizer handles string
inputs correctly.

---------

Co-authored-by: Brian Kroth <bpkroth@users.noreply.github.com>
@bpkroth bpkroth removed the ready for review Ready for review label Jul 22, 2024
@@ -261,7 +313,7 @@ def _transform(self, configuration: dict) -> dict:
# Clip value to force it to fall in [0, 1]
# NOTE: HeSBO projection ensures that theoretically but due to
# floating point ops nuances this is not always guaranteed
value = max(0.0, min(1.0, norm_value)) # pylint: disable=redefined-loop-name
value = max(0.0, min(1.0, norm_value))
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary pylint exception?

@bpkroth bpkroth self-assigned this Jul 23, 2024
@bpkroth
Copy link
Contributor

bpkroth commented Jul 23, 2024

Taking this over as a fix as well in a new PR - #812

@bpkroth bpkroth closed this Jul 23, 2024
motus added a commit that referenced this pull request Jul 29, 2024
…812)

Revamp of #806 with the fix as well.

Adds code to handle appropriate scaling and type conversion and checking
of the inverted config.

Splits that code out to a separate method for individual configs to make
pylint happy and improve code readability.

---------

Co-authored-by: Sergiy Matusevych <sergiym@microsoft.com>
Co-authored-by: Eu Jing Chua <chuaeujing@gmail.com>
Co-authored-by: Eu Jing Chua <eujingchua@microsoft.com>
Co-authored-by: Sergiy Matusevych <sergiy.matusevych@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mlos-core tests Add or fix unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LlamaTune inverse_trainsform() produces invalid configuration
3 participants