Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add SwanLab Logger Support
Summary
This PR adds support for SwanLab as a logging backend for LitGPT training and finetuning workflows. SwanLab is an experiment tracking and visualization tool that provides an alternative to existing loggers like TensorBoard, W&B, and MLFlow.
Based on Lightning-AI/pytorch-lightning#21506
Changes
Core Implementation
litgpt/utils.py:SwanLabLoggerimport fromlightning.pytorch.loggerschoose_logger()function to supportlogger_name="swanlab"project: Project name (defaults to experiment name)experiment_name: Experiment/run namedescription: Experiment descriptionlogdir: Log directory (defaults toout_dir/logs/swanlab)mode: SwanLab mode (defaults to "cloud")config: Additional configurationversion: Version (only used when resuming training)Type Annotations
Updated
logger_nameparameter type hints across all training scripts to include"swanlab":litgpt/pretrain.pyextensions/thunder/pretrain.pylitgpt/finetune/adapter.pylitgpt/finetune/adapter_v2.pylitgpt/finetune/full.pylitgpt/finetune/lora.pylitgpt/finetune/lora_legacy.pyTests
tests/test_utils.py:SwanLabLoggerimportchoose_logger("swanlab", ...)withRequirementCache("swanlab")checkValueErrorUsage
Users can now use SwanLab for logging by specifying
--logger_name swanlab:Additional SwanLab options can be passed via
--log_args:litgpt pretrain \ --logger_name swanlab \ --log_args.project my_project \ --log_args.mode disabled \ --log_args.description "My experiment" \ pythia-14mTesting
Tested locally with
litgpt pretrain pythia-14m --config config_hub/pretrain/debug.yamlto ensure basic functionality works correctly.Compatibility
swanlabpackage to be installed