Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/lightning/pytorch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [unreleased] - YYYY-MM-DD

### Added

- Allow LightningCLI to use a customized argument parser class ([#20596](https://github.com/Lightning-AI/pytorch-lightning/pull/20596))

### Changed

### Removed

### Fixed

## [2.5.0] - 2024-12-19

### Added
Expand Down
4 changes: 3 additions & 1 deletion src/lightning/pytorch/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ def __init__(
trainer_defaults: Optional[dict[str, Any]] = None,
seed_everything_default: Union[bool, int] = True,
parser_kwargs: Optional[Union[dict[str, Any], dict[str, dict[str, Any]]]] = None,
parser_class: type[LightningArgumentParser] = LightningArgumentParser,
subclass_mode_model: bool = False,
subclass_mode_data: bool = False,
args: ArgsType = None,
Expand Down Expand Up @@ -367,6 +368,7 @@ def __init__(
self.trainer_defaults = trainer_defaults or {}
self.seed_everything_default = seed_everything_default
self.parser_kwargs = parser_kwargs or {}
self.parser_class = parser_class
self.auto_configure_optimizers = auto_configure_optimizers

self.model_class = model_class
Expand Down Expand Up @@ -404,7 +406,7 @@ def _setup_parser_kwargs(self, parser_kwargs: dict[str, Any]) -> tuple[dict[str,
def init_parser(self, **kwargs: Any) -> LightningArgumentParser:
"""Method that instantiates the argument parser."""
kwargs.setdefault("dump_header", [f"lightning.pytorch=={pl.__version__}"])
parser = LightningArgumentParser(**kwargs)
parser = self.parser_class(**kwargs)
parser.add_argument(
"-c", "--config", action=ActionConfigFile, help="Path to a configuration file in json or yaml format."
)
Expand Down
Loading