Environment:AI4Finance Foundation FinGPT WandB
| Knowledge Sources | |
|---|---|
| Domains | Deep_Learning, MLOps |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
Weights and Biases (WandB) experiment tracking for logging training metrics, evaluation metrics, and generation samples during LoRA fine-tuning.
Description
This environment provides WandB integration for training experiment tracking. The training scripts set `WANDB_API_KEY` and `WANDB_PROJECT` environment variables, call `wandb.login()`, and pass `report_to='wandb'` to `TrainingArguments`. The `GenerationEvalCallback` logs evaluation metrics (e.g., ROUGE, BLEU) via `wandb.log(metrics, step=state.global_step)`. TensorBoard is also used alongside WandB.
Usage
Use this environment for any Training or Fine-Tuning workflow that logs metrics. Required by `Trainer_TrainingArguments` and `GenerationEvalCallback` implementations.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Any | Online service |
| Hardware | CPU sufficient | No GPU needed for logging |
| Network | Internet | Required to sync metrics to WandB cloud |
Dependencies
Python Packages
- `wandb` (latest)
- `tensorboard` (via `torch.utils.tensorboard.SummaryWriter`)
- `transformers` >= 4.32.0
Credentials
The following environment variables must be set:
- `WANDB_API_KEY`: Weights and Biases API key for authentication.
- `WANDB_PROJECT`: Project name (e.g., `fingpt-benchmark`, `fingpt-forecaster`).
Quick Install
pip install wandb tensorboard
Code Evidence
WandB configuration from `fingpt/FinGPT_Benchmark/train_lora.py:33-34`:
os.environ['WANDB_API_KEY'] = 'ecf1e5e4f47441d46822d38a3249d62e8fc94db4'
os.environ['WANDB_PROJECT'] = 'fingpt-benchmark'
Login and reporting from `fingpt/FinGPT_Benchmark/train_lora.py:131,212`:
report_to='wandb',
...
wandb.login()
Metric logging from `fingpt/FinGPT_Forecaster/train_lora.py:75-78`:
if wandb.run is None:
wandb.init()
wandb.log(metrics, step=state.global_step)
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `wandb.errors.AuthenticationError` | Invalid or missing API key | Set `WANDB_API_KEY` environment variable |
| `wandb.run is None` | WandB not initialized in callback | Auto-initializes via `wandb.init()` in callback |
| `Network error during sync` | Offline / firewall | Use `WANDB_MODE=offline` for local-only logging |
Compatibility Notes
- Hardcoded keys: Some training scripts contain hardcoded `WANDB_API_KEY` values (security risk); replace with environment variables.
- TensorBoard alongside: `TensorBoardCallback` and `SummaryWriter` are used in parallel with WandB.
- Offline mode: Set `WANDB_MODE=offline` to log locally without network access.