如何以编程方式设置 W&B 运行失败警报?

问题描述 投票:0回答:1

如何以编程方式设置 W&B 运行失败警报?

我正在尝试在 W&B(权重和偏差)项目中设置警报,以便在运行失败时通知我。我一直在测试一些我认为根据我的研究可以工作的功能,但似乎没有一个在 W&B API 中实现。这是我尝试设置这些通知的代码片段:

import wandb

mode = 'dryrun'
run_name = 'my_run'
num_batches = 50
path = '/data'
name = 'experiment1'
today = '2023-08-01'
probabilities = [0.1, 0.9]
batch_size = 32
data_mixture_name = 'mix1'

debug = mode == 'dryrun'
run = wandb.init(mode=mode, project="beyond-scale", name=run_name, save_code=True)
wandb.config.update({
    "num_batches": num_batches, 
    "path": path, 
    "name": name, 
    "today": today, 
    'probabilities': probabilities, 
    'batch_size': batch_size, 
    'debug': debug, 
    'data_mixture_name': data_mixture_name
})

# Attempts to set notifications
run.notify_on_failure()
run.notify_on_crash()
run.notify_on_exit()
run.notify_on_heartbeat()
run.notify_on_abort()

每次尝试都会产生

AttributeError
,表明“Run”对象没有此类属性。例如:

AttributeError: 'Run' object has no attribute 'notify_on_failure'

W&B 中是否有正确的方法来设置故障或其他警报?如果是这样,我应该如何修改我的方法?

参考:https://community.wandb.ai/t/how-do-i-set-the-wandb-alert-programatically-for-my-current-run/4891

machine-learning deep-learning neural-network conv-neural-network wandb
1个回答
0
投票

您可以在 try/ except 块中使用 wandb.alert(...) 。

在此处查看文档:https://docs.wandb.ai/guides/runs/alert

© www.soinside.com 2019 - 2024. All rights reserved.