Skip to content

Conversation

@RobotSail
Copy link
Member

@RobotSail RobotSail commented May 27, 2025

Addresses issue #569

Enhance training configuration and logging

  • Added new field log_level to TrainingArgs for improved training configuration.
  • Updated print_masked_samples to use print statements instead of logger for better visibility during data processing.
  • Integrated logging level configuration into the training setup, enabling dynamic log level adjustment.
  • Fixed command construction so log level is propagated down into the training command

@mergify mergify bot added the ci-failure label May 27, 2025
- Added new field `log_level` to `TrainingArgs` for improved training configuration.
- Updated `print_masked_samples` to use print statements instead of logger for better visibility during data processing.
- Integrated logging level configuration into the training setup, enabling dynamic log level adjustment.
- Fixed command construction so log level is propagated down into the training command

Signed-off-by: Oleg S <[email protected]>
setup_root_logger(train_args.log_level)
setup_metric_logger("async", None, train_args.ckpt_output_dir)

logger = logging.getLogger("instructlab.training")
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be inferred from:

Suggested change
logger = logging.getLogger("instructlab.training")
logger = logging.getLogger(__name__)

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will try this

"Pretraining" if unmask else "Instruction" + " ex sample %d: %s",
i + 1,
text,
print(f"\033[35mOriginal Input: {orig_text}\n\033[0m")
Copy link
Contributor

@JamesKunstle JamesKunstle May 27, 2025

Choose a reason for hiding this comment

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

I read your issue (#569) for this reversion and I see your point.

A user might not always wish to see these outputs, and may want to silence them by setting the log level higher than the level that this is logged. Maybe an alternative solution would be logger.info rather than logger.debug so that we could still use the logger here?

Having the formatted outputs always logged to the user isn't the standard behavior for other libraries (namely, Axolotl), so the previous behavior, while useful to us during development, might not be desirable.

Copy link
Member Author

Choose a reason for hiding this comment

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

@JamesKunstle I'm intentionally avoiding using the logger here because it applies formatting which misrepresents the actual content.

A user might not always wish to see these outputs, and may want to silence them by setting the log level higher than the level that this is logged. Maybe an alternative solution would be logger.info rather than logger.debug so that we could still use the logger here?

I would argue against this, for a few reasons:

  1. Most issues during training stem from data, therefore having a preview of what data you send to the model is a crucial step
  2. There is already a lot of noise which users do not care about, so providing an additional preview of their data does little to make that worse. If users don't wish to see a preview of their data, then all the other training logs that are printed today should also be muted. At this point, the program would likely be running somewhere where the user won't care or look at the logs anyway, so there's no reason to omit an otherwise useful step.

Copy link
Contributor

@JamesKunstle JamesKunstle left a comment

Choose a reason for hiding this comment

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

Generally in favor of all changes- question about switching logger.debug to print.

@aldopareja aldopareja self-requested a review May 28, 2025 06:26
@mergify mergify bot added the one-approval label May 28, 2025
@mergify mergify bot merged commit 17a7d19 into instructlab:main May 28, 2025
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants