-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Add MLFLOW_FLATTEN_PARAMS support in MLflowCallback #17148
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 MLFLOW_FLATTEN_PARAMS support in MLflowCallback #17148
Conversation
The documentation is not available anymore as the PR was closed or merged. |
@sgugger the script
This would lead to files starting by "py" to be improperly named. For example, A better replace() usage may be:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your PR! Could you move the new flatten_dict
function to the utils.generic
module? Also could you add a test for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the comments!
Looks like you messed the rebase a little bit and there are now commits in this PR that shouldn't be here. |
Yep. I messed up that rebase... |
Thanks again! |
* add support for MLFLOW_FLATTEN_PARAMS * ensure key is str * fix style and update warning msg * Empty commit to trigger CI * fix bug in check_inits.py * add unittest for flatten_dict utils * fix 'NoneType' object is not callable on __del__ * add generic flatten_dict unittest to SPECIAL_MODULE_TO_TEST_MAP * fix style
* add support for MLFLOW_FLATTEN_PARAMS * ensure key is str * fix style and update warning msg * Empty commit to trigger CI * fix bug in check_inits.py * add unittest for flatten_dict utils * fix 'NoneType' object is not callable on __del__ * add generic flatten_dict unittest to SPECIAL_MODULE_TO_TEST_MAP * fix style
What does this PR do?
This PR add support for the environment variable
MLFLOW_FLATTEN_PARAMS
.When first level parameters hold a dictionary value, it will be logged to MLflow as a string. Currently, it will skip that parameter when the string exceed 250 characters. This is especially true with the task_specific_params which can end up being a long string.
Current warning message look like this:
With this PR, the warning message is updated to:
When a user set the env variable with
os.environ['MLFLOW_FLATTEN_PARAMS'] = "True"
, the parameters will be properly sent to MLflow and logged as such:Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@sgugger I added a flatten_dict function in .utils/py_utils.py as it didn't seem right to add this in integrations.py.