本文整理汇总了Python中neptune.init方法的典型用法代码示例。如果您正苦于以下问题:Python neptune.init方法的具体用法?Python neptune.init怎么用?Python neptune.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neptune
的用法示例。
在下文中一共展示了neptune.init方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import neptune [as 别名]
# 或者: from neptune import init [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)
示例2: neptune_experiment_cls
# 需要导入模块: import neptune [as 别名]
# 或者: from neptune import init [as 别名]
def neptune_experiment_cls(self):
import neptune
neptune.init(project_qualified_name="tests/dry-run",
backend=neptune.OfflineBackend())
return neptune.create_experiment
示例3: wandb_run_cls
# 需要导入模块: import neptune [as 别名]
# 或者: from neptune import init [as 别名]
def wandb_run_cls(self):
import wandb
os.environ['WANDB_MODE'] = 'dryrun' # run offline
with wandb.init(anonymous="allow") as run:
return run
示例4: start_experiment
# 需要导入模块: import neptune [as 别名]
# 或者: from neptune import init [as 别名]
def start_experiment(self):
neptune.init(project_qualified_name=self.config.project)
neptune.create_experiment(name=self.config.name,
params=self.params,
upload_source_files=get_filepaths(),
tags=self.config.tags)
示例5: __init__
# 需要导入模块: import neptune [as 别名]
# 或者: from neptune import init [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)