question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[logging] Turn off loss logging, while keeping progress bar and logging to third-party application

See original GitHub issue

Feature request

I would like to add a training argument to the TrainingArguments class to turn off the loss logging to stdout while keeping the progress bar and logging to a third-party application like Weights and Biases.

Motivation

I am working on a project that trains a model with the Trainer class. I need to log the losses at every epoch to Weights and Biases. Here is my code:

training_arguments = TrainingArguments(
    output_dir="./logging_dir",
    num_train_epochs=epochs,
    per_device_train_batch_size=batch_size,
    per_device_eval_batch_size=batch_size,
    report_to="wandb",
    logging_strategy="epoch",
)

trainer = Trainer(
    model=model,
    args=training_arguments,
    tokenizer=tokenizer,
    train_dataset=train_dataset,
    eval_dataset=eval_dataset,
)

This code is contained in a python file train.py and is launched in the terminal via the command python train.py. However, I don’t want to have the loss printed because it breaks my progress bar as you can see in the image below and I need the progress bar to give some feedback on the training time.

cut_progress_bar

Your contribution

I think that I could add a disable_on_log argument to TrainingArguments. Then in the on_log of the ProgressCallback, a condition should be added like this:

def on_log(self, args, state, control, logs=None, **kwargs):
    if state.is_local_process_zero and self.training_bar is not None and args.disable_on_log:
         _ = logs.pop("total_flos", None)
         self.training_bar.write(str(logs))

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
antonioloisoncommented, Jul 11, 2022

Yes, I’ve tried that, but this makes my progress bar disappear and keeps the loss logging. I want to do the opposite, keep my progress bar and remove the loss logging.

0reactions
github-actions[bot]commented, Aug 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to log while using a progress bar from rich ... - GitHub
Hello, I am trying to figure out the best way to use loguru to log while also using a rich progress bar. In...
Read more >
Progress bar and status logging in python with tqdm
The idea behind this “hack” is to use progress bars for the status logging by removing everything but the description field. This way...
Read more >
How do I enable/disable log levels in Android? - Stack Overflow
You can use Log. useLog(false) to disable logging at all. Save this answer. Show activity on this post.
Read more >
Logging - Hugging Face
Diffusers has a centralized logging system, so that you can setup the verbosity ... By default, tqdm progress bars will be displayed during...
Read more >
Job logs - GitLab Docs
Running jobs' logs continue to be written to disk, but new jobs use incremental logging. To disable incremental logging: Feature.disable(:ci_enable_live_trace).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found