Environment:Shiyu coder Kronos Comet ML Logging
| Knowledge Sources | |
|---|---|
| Domains | Experiment_Tracking, Infrastructure |
| Last Updated | 2026-02-09 13:47 GMT |
Overview
Optional Comet ML experiment tracking integration for logging training metrics, hyperparameters, and model performance during Qlib finetuning.
Description
The Qlib finetuning pipeline integrates Comet ML for experiment tracking. When enabled (`use_comet=True` in config), training metrics (loss, learning rate, validation loss) are logged to a Comet ML workspace. The integration is optional and can be disabled by setting `use_comet=False`. The Comet API key and workspace must be configured in `finetune/config.py` or loaded from environment variables.
Usage
Use this environment when you want to track and visualize Qlib finetuning experiments. Disable it for local development or when Comet ML access is unavailable. This environment is only relevant to the Qlib Finetuning Pipeline workflow.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| Network | Internet access | Required for sending metrics to Comet ML servers |
Dependencies
Python Packages
- `comet_ml` (latest version)
Credentials
The following must be configured in `finetune/config.py` or via environment variables:
- `COMET_API_KEY`: Comet ML API key for authentication
- Comet workspace name (configured in `comet_config['workspace']`)
- Comet project name (configured in `comet_config['project_name']`)
Quick Install
pip install comet_ml
# Set API key via environment variable (recommended)
export COMET_API_KEY="your_api_key_here"
Code Evidence
Comet ML configuration with placeholder values from `finetune/config.py:75-84`:
self.use_comet = True # Set to False if you don't want to use Comet ML
self.comet_config = {
# It is highly recommended to load secrets from environment variables
# for security purposes. Example: os.getenv("COMET_API_KEY")
"api_key": "YOUR_COMET_API_KEY",
"project_name": "Kronos-Finetune-Demo",
"workspace": "your_comet_workspace" # TODO: Change to your Comet ML workspace name
}
Comet ML experiment initialization from `finetune/train_predictor.py:199-208`:
if config['use_comet']:
comet_logger = comet_ml.Experiment(
api_key=config['comet_config']['api_key'],
project_name=config['comet_config']['project_name'],
workspace=config['comet_config']['workspace'],
)
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `ModuleNotFoundError: No module named 'comet_ml'` | Comet ML not installed | `pip install comet_ml` or set `use_comet=False` |
| `CometRestApiException: Invalid API key` | Wrong or placeholder API key | Replace `YOUR_COMET_API_KEY` with actual key or use `os.getenv("COMET_API_KEY")` |
| `ConnectionError` | No internet access | Set `use_comet=False` for offline training |
Compatibility Notes
- Optional: Set `use_comet=False` in config to skip entirely. Training proceeds normally without it.
- Security: The config file contains placeholder API keys. Always load secrets from environment variables in production.
- Scope: Only used by Qlib finetuning scripts (`train_tokenizer.py`, `train_predictor.py`). Not used by CSV finetuning or inference.