Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Fix log messages #549

Merged
merged 5 commits into from
Sep 27, 2022
Merged

Fix log messages #549

merged 5 commits into from
Sep 27, 2022

Conversation

guenthermi
Copy link
Member

@guenthermi guenthermi commented Sep 23, 2022

  • Removes info and debug log messages from commons packages
  • add spinner for waiting until finetuning job is started
  • remove envelops in stream log messages
  • move console related functions and configuration into new module

  • This PR references an open issue
  • I have added a line about this change to CHANGELOG

@guenthermi guenthermi linked an issue Sep 23, 2022 that may be closed by this pull request
@guenthermi guenthermi marked this pull request as draft September 23, 2022 14:46
Copy link
Member

@bwanglzu bwanglzu left a comment

Choose a reason for hiding this comment

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

i like the spiner! much better than print

finetuner/run.py Outdated
print(msg)
else:
break
console = Console(width=200)
Copy link
Member

Choose a reason for hiding this comment

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

create Console outside from the function, also check describe_models.

yield entry.decode('utf-8', errors='ignore')
decoded_message: str = entry.decode('utf-8', errors='ignore')
sep_pos = decoded_message.find(': ')
if sep_pos != -1:
Copy link
Member

Choose a reason for hiding this comment

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

can you elaberate what is this doing?

Copy link
Member Author

Choose a reason for hiding this comment

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

The EventSourceResponse class generates different kinds of log message (e.g., "event" and "data" messages). It adds this type at the beginning of the message, e.g., "data: Finetuning ...". This code snippet divides the type and the message by splitting it at the first occurrence of ": " and only returns the message itself as log message.

Copy link
Member

Choose a reason for hiding this comment

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

what if sep_pos is None?

Copy link
Member Author

Choose a reason for hiding this comment

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

The find function returns -1 if it is not present. Therefore, I check for -1

@github-actions github-actions bot added size/m and removed size/s labels Sep 26, 2022
@guenthermi guenthermi marked this pull request as ready for review September 26, 2022 07:18
Copy link
Member

@bwanglzu bwanglzu left a comment

Choose a reason for hiding this comment

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

minor comment, can you attach a screenshot in the PR description of the spinner?

yield entry.decode('utf-8', errors='ignore')
decoded_message: str = entry.decode('utf-8', errors='ignore')
sep_pos = decoded_message.find(': ')
if sep_pos != -1:
Copy link
Member

Choose a reason for hiding this comment

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

what if sep_pos is None?

@@ -347,6 +326,9 @@ def get_model(
"""
from commons.data.inference import ONNXRuntimeInferenceEngine

for key in logging.root.manager.loggerDict:
logging.getLogger(key).setLevel('CRITICAL')
Copy link
Member

Choose a reason for hiding this comment

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

why are you silencing all loggers?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought that we only want to log the messages of the executor which are set by the ONNXRuntimeInferenceEngine. However, I can also change it to only silence the commons and the ulrlib logger in the case we want to log more. However, this means that there might occur other unexpected log messages after some changes.

Copy link
Member

Choose a reason for hiding this comment

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

try to silence only these loggers first, and see how it looks

@guenthermi
Copy link
Member Author

Cleaned up loggs:
Screenshot from 2022-09-27 14-32-20
Spinner which shows up before logs are available:
Screenshot from 2022-09-27 14-29-07

Copy link
Member

@bwanglzu bwanglzu left a comment

Choose a reason for hiding this comment

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

LGTM!

@guenthermi guenthermi merged commit 2b229cd into main Sep 27, 2022
@guenthermi guenthermi deleted the fix-log-messages branch September 27, 2022 15:07
guenthermi added a commit that referenced this pull request Sep 27, 2022
guenthermi added a commit that referenced this pull request Sep 27, 2022
@guenthermi guenthermi restored the fix-log-messages branch September 27, 2022 15:19
@guenthermi guenthermi mentioned this pull request Sep 27, 2022
2 tasks
@guenthermi guenthermi deleted the fix-log-messages branch September 28, 2022 13:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve logging in the Client
3 participants