src/transformers/integrations.py/NeptuneCallback/setup
class NeptuneCallback:    def setup(self, args, state, model):
        """
        Setup the Neptune integration.

        Environment:
            NEPTUNE_PROJECT (:obj:`str`, `required`):
                The project ID for neptune.ai account. Should be in format `workspace_name/project_name`
            NEPTUNE_API_TOKEN (:obj:`str`, `required`):
                API-token for neptune.ai account
            NEPTUNE_CONNECTION_MODE (:obj:`str`, `optional`):
                Neptune connection mode. `async` by default
            NEPTUNE_RUN_NAME (:obj:`str`, `optional`):
                The name of run process on Neptune dashboard
        """
        if state.is_world_process_zero:
            self._neptune_run = self._neptune.init(
                project=os.getenv("NEPTUNE_PROJECT"),
                api_token=os.getenv("NEPTUNE_API_TOKEN"),
                mode=os.getenv("NEPTUNE_CONNECTION_MODE", "async"),
                name=os.getenv("NEPTUNE_RUN_NAME", None),
                run=os.getenv("NEPTUNE_RUN_ID", None),
            )
            combined_dict = args.to_dict()
            if hasattr(model, "config") and model.config is not None:
                model_config = model.config.to_dict()
                combined_dict = {**model_config, **combined_dict}
            self._neptune_run["parameters"] = combined_dict
        self._initialized = True