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

put the monitor metric into default filename for ModelCheckpoint #20397

Open
VDFaller opened this issue Nov 5, 2024 · 0 comments
Open

put the monitor metric into default filename for ModelCheckpoint #20397

VDFaller opened this issue Nov 5, 2024 · 0 comments
Labels
feature Is an improvement or enhancement needs triage Waiting to be triaged by maintainers

Comments

@VDFaller
Copy link

VDFaller commented Nov 5, 2024

Description & Motivation

Tiny annoyance, but wouldn't it make sense to put the monitor value in the default value of the filename so it's not just epoch-X-step-y by default?

Pitch

Couldn't something like this work here?

    def _format_checkpoint_name(
        self,
        filename: Optional[str],
        metrics: Dict[str, Tensor],
        prefix: str = "",
        auto_insert_metric_name: bool = True,
    ) -> str:
        if not filename:
            if self.monitor is not None and self.monitor in metrics:
                filename = "{epoch}" + self.CHECKPOINT_JOIN_CHAR + "{step}" + self.CHECKPOINT_JOIN_CHAR + f"{{{self.monitor}}}"
            # filename is not set, use default name
            else:
                filename = "{epoch}" + self.CHECKPOINT_JOIN_CHAR + "{step}"

Alternatives

No response

Additional context

Happy to put it in MR

cc @Borda

@VDFaller VDFaller added feature Is an improvement or enhancement needs triage Waiting to be triaged by maintainers labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement needs triage Waiting to be triaged by maintainers
Projects
None yet
Development

No branches or pull requests

1 participant