Skip to content

fix(finetune): make Comet logging optional - #390

Open
MohammadWasi wants to merge 1 commit into
shiyu-coder:masterfrom
MohammadWasi:fix/optional-comet-logging
Open

MohammadWasi wants to merge 1 commit into
shiyu-coder:masterfrom
MohammadWasi:fix/optional-comet-logging

Conversation

@MohammadWasi

@MohammadWasi MohammadWasi commented Aug 13, 2026 •

Copy link
Copy Markdown

Summary

  • make Comet ML an optional dependency for the Qlib fine-tuning workflow
  • disable Comet logging by default because the checked-in configuration contains placeholder credentials
  • keep the existing Comet behavior unchanged when use_comet is explicitly enabled

Problem

Both finetune/train_tokenizer.py and finetune/train_predictor.py imported comet_ml unconditionally. As a result, a user who follows the documented no-Comet path (use_comet = False) still fails before training starts unless Comet is installed.

Implementation

  • add finetune/utils/experiment_logging.py to lazily create a Comet experiment only when enabled
  • provide an actionable error when logging is enabled but comet_ml is missing
  • reuse the helper from both fine-tuning entry points
  • document how to opt in to Comet logging

Tests

  • python -m unittest tests/test_experiment_logging.py
  • python -m py_compile finetune/config.py finetune/train_tokenizer.py finetune/train_predictor.py finetune/utils/experiment_logging.py
  • git diff --check

The new tests verify that disabled logging does not import Comet, enabled logging explains a missing dependency, and valid Comet configuration creates and configures the experiment.

@MohammadWasi

MohammadWasi commented Aug 14, 2026 •

Copy link
Copy Markdown
Author

Hi @AnMakc @ehan1990 @alexliao @xxsunyxx Can you please review this and share your feedacks?

@itsadrianxv itsadrianxv left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks — nice usability improvement. Moving import comet_ml out of module scope into utils/experiment_logging.py means fine-tuning runs without Comet installed, and defaulting use_comet = False avoids surprising failures for new users. Lazy import is the right pattern here, and the new unit test covers the helper. LGTM 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants