Repository: Lightning-AI/pytorch-lightning
File: pytorch_lightning/loggers/neptune.py (Python)

Code before:
            :func:`neptune.Session.create_experiment` can be passed as keyword arguments in this logger.
    """

    def __init__(
        self,
        api_key: Optional[str] = None,
        project_name: Optional[str] = None,
        close_after_fit: Optional[bool] = True,
        offline_mode: bool = False,
        experiment_name: Optional[str] = None,
        experiment_id: Optional[str] = None,
        **kwargs
    ):
        if neptune is None:
            raise ImportError('You want to use `neptune` logger which is not installed yet,'
                              ' install it with `pip install neptune-client`.')
        super().__init__()
        self.api_key = api_key
        self.project_name = project_name
        self.offline_mode = offline_mode
        self.close_after_fit = close_after_fit
        self.experiment_name = experiment_name
        self._kwargs = kwargs
        self.experiment_id = experiment_id
        self._experiment = self._create_or_get_experiment()

        log.info(f'NeptuneLogger will work in {"offline" if self.offline_mode else "online"} mode')

    def __getstate__(self):
        state = self.__dict__.copy()

        # Experiment cannot be pickled, and additionally its ID cannot be pickled in offline mode
        state['_experiment'] = None
        if self.offline_mode:
            state['experiment_id'] = None

        return state

    @property
    @rank_zero_experiment
    def experiment(self) -> Experiment:
        r"""
        Actual Neptune object. To use neptune features in your
        :class:`~pytorch_lightning.core.lightning.LightningModule` do the following.

        Example::

            self.logger.experiment.some_neptune_function()

        """


Review comment (suggestion):
experiment_id can't be private here?
```suggestion
        self._experiment_id = experiment_id
```

Code after:
            on fetched experiment data.
        \**kwargs: Additional arguments like `params`, `tags`, `properties`, etc. used by
            :func:`neptune.Session.create_experiment` can be passed as keyword arguments in this logger.
    """

    def __init__(
        self,
        api_key: Optional[str] = None,
        project_name: Optional[str] = None,
        close_after_fit: Optional[bool] = True,
        offline_mode: bool = False,
        experiment_name: Optional[str] = None,
        experiment_id: Optional[str] = None,
        **kwargs
    ):
        if neptune is None:
            raise ImportError('You want to use `neptune` logger which is not installed yet,'
                              ' install it with `pip install neptune-client`.')
        super().__init__()
        self.api_key = api_key
        self.project_name = project_name
        self.offline_mode = offline_mode
        self.close_after_fit = close_after_fit
        self.experiment_name = experiment_name
        self._kwargs = kwargs
        self.experiment_id = experiment_id
        self._experiment = self._create_or_get_experiment()

        log.info(f'NeptuneLogger will work in {"offline" if self.offline_mode else "online"} mode')

    def __getstate__(self):
        state = self.__dict__.copy()

        # Experiment cannot be pickled, and additionally its ID cannot be pickled in offline mode
        state['_experiment'] = None
        if self.offline_mode:
            state['experiment_id'] = None

        return state

    @property
    @rank_zero_experiment
    def experiment(self) -> Experiment:
        r"""
        Actual Neptune object. To use neptune features in your
        :class:`~pytorch_lightning.core.lightning.LightningModule` do the following.

        Example::

            self.logger.experiment.some_neptune_function()