class_docstr: Implementation of a configurable command line tool for pytorch-lightning.
class_docstr_tok: ["Implementation","of","a","configurable","command","line","tool","for","pytorch-lightning","."]
docstr: Initialize and setup the parser, subcommands, and arguments.
code: def setup_parser(
      self,
      add_subcommands: bool,
      main_kwargs: Dict[str, Any],
      subparser_kwargs: Dict[str, Any],
  ) -> None:
      """Initialize and setup the parser, subcommands, and arguments."""
      self.parser = self.init_parser(**main_kwargs)
      if add_subcommands:
          self._subcommand_method_arguments: Dict[str, List[str]] = {}
          self._add_subcommands(self.parser, **subparser_kwargs)
      else:
          self._add_arguments(self.parser)
  
imports: import os
  import sys
  from functools import partial, update_wrapper
  from types import MethodType
  from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, Type, Union
  import torch
  from lightning_utilities.core.imports import RequirementCache
  from lightning_utilities.core.rank_zero import _warn
  from torch.optim import Optimizer
  from typing_extensions import override
  import lightning.pytorch
  from lightning.fabric.utilities.cloud_io import get_filesystem
  from lightning.fabric.utilities.types import _TORCH_LRSCHEDULER
  from lightning.pytorch import Callback, LightningDataModule, LightningModule, Trainer, seed_everything
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.model_helpers import is_overridden
  from lightning.pytorch.utilities.rank_zero import rank_zero_warn
label_desc: Use image node_id 4 for calling the LightningCLI obj's underlying member method code with example usage: obj.setup_parser(add_subcommands, main_kwargs, subparser_kwargs) without return types