Skip to content

Conversation

Innixma
Copy link
Contributor

@Innixma Innixma commented Feb 18, 2025

Issue #, if available:

Description of changes:

Fix setup_outputdir

  • Force path_suffix to always result in a new directory if specified and path=None. Previously it could result in appending a str to ag-{timestamp} without making a new directory. For example, initializing CatBoostModel with path=None would create AutogluonModels/ag-{...}CatBoost, instead of AutogluonModels/ag-{...}/CatBoost
  • Fix unnecessary warning logged when path=None is the input.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Innixma Innixma added the code cleanup Fixing warnings/deprecations/syntax/etc. label Feb 18, 2025
@Innixma Innixma added this to the 1.3 Release milestone Feb 18, 2025
Copy link
Collaborator

@shchur shchur left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -22,7 +24,7 @@
LITE_MODE: bool = __lite__ is not None and __lite__


def setup_outputdir(path, warn_if_exist=True, create_dir=True, path_suffix=None):
def setup_outputdir(path: str | None, warn_if_exist: bool = True, create_dir: bool = True, path_suffix: str | None = None) -> str:
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a general comment, do we ever call setup_outpudir(path=None) during predictor.fit()? Or is this just a fallback option that is used when the model is used as a standalone object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we do, for example, if predictor = TabularPredictor(label=label), this calls setup_outputdir(path=None) to create the predictor's directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example prior to this PR showing the unnecessary warning:

No path specified. Models will be saved in: "AutogluonModels/ag-20250218_215911"
Warning: path already exists! This predictor may overwrite an existing predictor! path="AutogluonModels/ag-20250218_215911"

Copy link

Job PR-4903-3e7be79 is done.
Docs are uploaded to http://autogluon-staging.s3-website-us-west-2.amazonaws.com/PR-4903/3e7be79/index.html

@Innixma Innixma merged commit dd71e1b into autogluon:master Feb 18, 2025
27 checks passed
@Innixma Innixma deleted the setup_outputdir_fix branch April 16, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup Fixing warnings/deprecations/syntax/etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants