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

Logs generated before calling LearnerBuilder::build are discarded in some examples #2594

Open
towerpark opened this issue Dec 6, 2024 · 2 comments

Comments

@towerpark
Copy link
Contributor

towerpark commented Dec 6, 2024

Describe the bug
In some examples, logs generated before calling LearnerBuilder::build don't get saved to the log file.

Some of the examples affected by this issue are: mnist, text_classification, text_generation. Examples of the discarded logs are of target burn_train::metric::cuda, cubecl_wgpu::runtime, hf_hub, all of which are generated at the pre-model-fitting stage.

The cause is that the built-in logger doesn't get installed until LearnerBuilder::build is called, and no other logger is set before that, so those logs are ignored by the log macros.

To Reproduce
A couple of extra lines will appear at the head of the log file if we set a logger manually as follows instead of relying on LearnerBuilder to do it:

  1. Create an instance of FileApplicationLoggerInstaller (from burn-train) and install it at the begin of the program;
  2. Call .with_application_logger(None) before building the learner.

Expected behavior
All the logs written via the log crate should be saved into log files.

Maybe LearnerBuilder::tracing_logger should default to None so that users can be freed from making the .with_application_logger(None) call every time they want to use Learner without losing any logs.

====
UPDATE: Added the cause.

@laggui
Copy link
Member

laggui commented Dec 6, 2024

Thanks for opening this!

I'll link this comment from our previous discussion to add the initial context.

@towerpark
Copy link
Contributor Author

Thanks for adding that.
I should have included the link in the post 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants