-
Notifications
You must be signed in to change notification settings - Fork 256
Add type hints to methods in custom_loggers.py #455
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||
| # Standard library | ||||||
| import sys | ||||||
| from typing import Optional, Dict, Any | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| # Third-party | ||||||
| import mlflow | ||||||
|
|
@@ -15,7 +16,9 @@ class CustomMLFlowLogger(pl.loggers.MLFlowLogger): | |||||
| of version `2.0.3` at least. | ||||||
| """ | ||||||
|
|
||||||
| def __init__(self, experiment_name, tracking_uri, run_name): | ||||||
| def __init__( | ||||||
| self, experiment_name: str, tracking_uri: str, run_name: str | ||||||
| ) -> None: | ||||||
| super().__init__( | ||||||
| experiment_name=experiment_name, tracking_uri=tracking_uri | ||||||
| ) | ||||||
|
|
@@ -25,7 +28,7 @@ def __init__(self, experiment_name, tracking_uri, run_name): | |||||
| mlflow.log_param("run_id", self.run_id) | ||||||
|
|
||||||
| @property | ||||||
| def save_dir(self): | ||||||
| def save_dir(self) -> str: | ||||||
| """ | ||||||
| Returns the directory where the MLFlow artifacts are saved. | ||||||
| Used to define the path to save output when using the logger. | ||||||
|
|
@@ -37,7 +40,9 @@ def save_dir(self): | |||||
| """ | ||||||
| return "mlruns" | ||||||
|
|
||||||
| def log_image(self, key, images, step=None): | ||||||
| def log_image( | ||||||
| self, key: str, images: list, step: Optional[int] = None | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ) -> None: | ||||||
| """ | ||||||
| Log a matplotlib figure as an image to MLFlow | ||||||
|
|
||||||
|
|
||||||
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.
Only Optional is actually used in this file now. Dict and Any are unused imports.