當前位置: 首頁>>代碼示例>>Python>>正文


Python neptune.OfflineBackend方法代碼示例

本文整理匯總了Python中neptune.OfflineBackend方法的典型用法代碼示例。如果您正苦於以下問題:Python neptune.OfflineBackend方法的具體用法?Python neptune.OfflineBackend怎麽用?Python neptune.OfflineBackend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在neptune的用法示例。


在下文中一共展示了neptune.OfflineBackend方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _create_or_get_experiment

# 需要導入模塊: import neptune [as 別名]
# 或者: from neptune import OfflineBackend [as 別名]
def _create_or_get_experiment(self):
        if self.offline_mode:
            project = neptune.Session(backend=neptune.OfflineBackend()).get_project('dry-run/project')
        else:
            session = neptune.Session.with_default_backend(api_token=self.api_key)
            project = session.get_project(self.project_name)

        if self._experiment_id is None:
            exp = project.create_experiment(
                name=self.experiment_name,
                params=self.params,
                properties=self.properties,
                tags=self.tags,
                upload_source_files=self.upload_source_files,
                **self._kwargs)
        else:
            exp = project.get_experiments(id=self._experiment_id)[0]

        self._experiment_id = exp.id
        return exp 
開發者ID:PyTorchLightning,項目名稱:pytorch-lightning,代碼行數:22,代碼來源:neptune.py

示例2: __init__

# 需要導入模塊: import neptune [as 別名]
# 或者: from neptune import OfflineBackend [as 別名]
def __init__(self, *args, **kwargs):
        try:
            import neptune
        except ImportError:
            raise RuntimeError(
                "This contrib module requires neptune-client to be installed. "
                "You may install neptune with command: \n pip install neptune-client \n"
            )

        if kwargs.get("offline_mode", False):
            self.mode = "offline"
            neptune.init(project_qualified_name="dry-run/project", backend=neptune.OfflineBackend())
        else:
            self.mode = "online"
            neptune.init(api_token=kwargs.get("api_token"), project_qualified_name=kwargs.get("project_name"))

        kwargs["name"] = kwargs.pop("experiment_name", None)
        self._experiment_kwargs = {
            k: v for k, v in kwargs.items() if k not in ["api_token", "project_name", "offline_mode"]
        }

        self.experiment = neptune.create_experiment(**self._experiment_kwargs) 
開發者ID:pytorch,項目名稱:ignite,代碼行數:24,代碼來源:neptune_logger.py

示例3: neptune_experiment_cls

# 需要導入模塊: import neptune [as 別名]
# 或者: from neptune import OfflineBackend [as 別名]
def neptune_experiment_cls(self):
        import neptune
        neptune.init(project_qualified_name="tests/dry-run",
                     backend=neptune.OfflineBackend())
        return neptune.create_experiment 
開發者ID:skorch-dev,項目名稱:skorch,代碼行數:7,代碼來源:test_logging.py

示例4: __init__

# 需要導入模塊: import neptune [as 別名]
# 或者: from neptune import OfflineBackend [as 別名]
def __init__(
        self,
        metric_names: List[str] = None,
        log_on_batch_end: bool = True,
        log_on_epoch_end: bool = True,
        offline_mode: bool = False,
        **logging_params,
    ):
        """
        Args:
            metric_names (List[str]): list of metric names to log,
                if none - logs everything
            log_on_batch_end (bool): logs per-batch metrics if set True
            log_on_epoch_end (bool): logs per-epoch metrics if set True
            offline_mode (bool): whether logging to Neptune server should
                 be turned off. It is useful for debugging
        """
        super().__init__(
            order=CallbackOrder.logging,
            node=CallbackNode.master,
            scope=CallbackScope.experiment,
        )
        self.metrics_to_log = metric_names
        self.log_on_batch_end = log_on_batch_end
        self.log_on_epoch_end = log_on_epoch_end

        if not (self.log_on_batch_end or self.log_on_epoch_end):
            raise ValueError("You have to log something!")

        if (self.log_on_batch_end and not self.log_on_epoch_end) or (
            not self.log_on_batch_end and self.log_on_epoch_end
        ):
            self.batch_log_suffix = ""
            self.epoch_log_suffix = ""
        else:
            self.batch_log_suffix = "_batch"
            self.epoch_log_suffix = "_epoch"

        if offline_mode:
            neptune.init(
                project_qualified_name="dry-run/project",
                backend=neptune.OfflineBackend(),
            )
        else:
            neptune.init(
                api_token=logging_params["api_token"],
                project_qualified_name=logging_params["project_name"],
            )

        logging_params.pop("api_token")
        logging_params.pop("project_name")

        self.experiment = neptune.create_experiment(**logging_params) 
開發者ID:catalyst-team,項目名稱:catalyst,代碼行數:55,代碼來源:neptune_logger.py


注:本文中的neptune.OfflineBackend方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。