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

fix: invalid print #817

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
swankit==0.1.2b6
swankit==0.1.3
swanboard==0.1.7b1
cos-python-sdk-v5
urllib3>=1.26.0
Expand Down
5 changes: 4 additions & 1 deletion swanlab/data/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def wrapper(*args, **kwargs):


@should_call_after_init("You must call swanlab.init() before using log()")
def log(data: Dict[str, DataType], step: int = None):
def log(data: Dict[str, DataType], step: int = None, print_to_console: bool = False):
"""
Log a row of data to the current run.
We recommend that you log data by SwanLabRun.log() method, but you can also use this function to log data.
Expand All @@ -262,9 +262,12 @@ def log(data: Dict[str, DataType], step: int = None):
step : int, optional
The step number of the current data, if not provided, it will be automatically incremented.
If step is duplicated, the data will be ignored.
print_to_console : bool, optional
Whether to print the data to the console, the default is False.
"""
run = get_run()
ll = run.log(data, step)
print_to_console and print(ll)
return ll


Expand Down