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

Typo breaks mlflow logger in 1.9.0 #16411

Closed
markdjwilliams opened this issue Jan 17, 2023 · 7 comments · Fixed by #16418
Closed

Typo breaks mlflow logger in 1.9.0 #16411

markdjwilliams opened this issue Jan 17, 2023 · 7 comments · Fixed by #16418
Assignees
Labels
bug Something isn't working logger: mlflow
Milestone

Comments

@markdjwilliams
Copy link

markdjwilliams commented Jan 17, 2023

Bug description

This line of code appears to be broken in 1.9.0 as it erroneously passes the value of the parameter where it should be providing the name:

params_list.append(Param(key=v, value=v))

This should instead likely be:

params_list.append(Param(key=k, value=v))

How to reproduce the bug

from collections import OrderedDict
from lightning.pytorch.loggers import MLFlowLogger

params = OrderedDict()
params["a"] = 1

MLFlowLogger().log_hyperparams(params)

Error messages and logs

TypeError: expected string or bytes-like object

Environment

Current environment
#- Lightning Component (e.g. Trainer, LightningModule, LightningApp, LightningWork, LightningFlow):
#- PyTorch Lightning Version (e.g., 1.5.0): 1.9.0
#- Lightning App Version (e.g., 0.5.2):
#- PyTorch Version (e.g., 1.10):
#- Python version (e.g., 3.9):
#- OS (e.g., Linux): Linux
#- CUDA/cuDNN version:
#- GPU models and configuration:
#- How you installed Lightning(`conda`, `pip`, source): source
#- Running environment of LightningApp (e.g. local, cloud): local

More info

No response

cc @Borda

@markdjwilliams markdjwilliams added the needs triage Waiting to be triaged by maintainers label Jan 17, 2023
@awaelchli
Copy link
Contributor

@markdjwilliams Great that you spotted it. A PR with the fix would be greatly appreciated if you are interested :)

@awaelchli awaelchli added bug Something isn't working logger: mlflow and removed needs triage Waiting to be triaged by maintainers labels Jan 18, 2023
@awaelchli awaelchli added this to the v1.9.x milestone Jan 18, 2023
@awaelchli awaelchli added the help wanted Open to be worked on label Jan 18, 2023
@Borda Borda added the good first issue Good for newcomers label Jan 18, 2023
@markdjwilliams
Copy link
Author

Thank you for taking a look. I'm not sure if there's any test coverage here, but there's a chance that this should even be:

params_list.append(Param(key=k, value=str(v)))

.... as I can see that mlflow's Param class does seem to expect to be working with only string values:

https://github.com/mlflow/mlflow/blob/2487179a9f239024667946e7d31706a91f2536b8/mlflow/entities/param.py

https://github.com/mlflow/mlflow/blob/2487179a9f239024667946e7d31706a91f2536b8/mlflow/utils/autologging_utils/client.py

@awaelchli
Copy link
Contributor

This code was added in this PR: #15915
Let's ask to double check:
@schmidt-jake Have you used the code with different types for these parameters? Would you mind quickly reviewing the bugfix PR from @BrianPulfer #16418

@Borda
Copy link
Member

Borda commented Jan 19, 2023

@BrianPulfer mind commenting here so we can sign the issue to you? 🦦

@Borda Borda removed help wanted Open to be worked on good first issue Good for newcomers labels Jan 19, 2023
@schmidt-jake
Copy link
Contributor

schmidt-jake commented Jan 19, 2023

Gah, sorry for the silly mistake 😦

Have you used the code with different types for these parameters?

No, but I could add some test cases for this.

Happy to review #16418 if someone with permissions could request it.

@BrianPulfer
Copy link
Contributor

@BrianPulfer mind commenting here so we can sign the issue to you? otter

Yes sure!

@awaelchli
Copy link
Contributor

@schmidt-jake There isn't a "formal" way through GitHub to request your review. If you agree with the change, then we will merge it after adding a test. There was also a question from #16411 (comment) whether the value should be converted to string. But I think that's only necessary for unsupported types. This can be addressed separately if needed.

Borda pushed a commit that referenced this issue Jan 20, 2023
Borda pushed a commit that referenced this issue Feb 9, 2023
Resolves #16411

(cherry picked from commit 6fd914f)
lantiga pushed a commit that referenced this issue Feb 10, 2023
Resolves #16411

(cherry picked from commit 6fd914f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working logger: mlflow
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants