Skip to content
alkaiddubhePublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notifier

向飞书机器人 Webhook 发送通知的 Python 包。

安装

pip install -e /root/dubhe/Notifier

配置

设置环境变量(推荐写入 ~/.bashrc 或 ~/.zshrc):

export FEISHU_WEBHOOK_URL="https://open.feishu.cn/open-apis/bot/v2/hook/你的token"

用法

方式一:模块级函数(无状态)

from notifier import send_text, send_card

# 发送纯文本
send_text("训练已完成!")

# 发送带标题的卡片
send_card(
    title="训练完成",
    content="模型已收敛,可以查看结果。",
    fields={"Loss": "0.042", "Accuracy": "97.3%", "Epochs": "100"},
)

方式二:FeishuNotifier 实例(有状态)

from notifier import FeishuNotifier

notify = FeishuNotifier(default_title="MyExperiment")

# 训练结束后调用
notify.done(
    title="实验 #42 完成",
    message="训练已结束,最佳 checkpoint 保存在 ./ckpt/best.pth",
    fields={"Best Loss": "0.038", "Val Acc": "98.1%"},
)

# 也可以发简单文本
notify.text("数据预处理完成")

不依赖环境变量

from notifier import FeishuNotifier

notify = FeishuNotifier(webhook_url="https://open.feishu.cn/open-apis/bot/v2/hook/xxx")
notify.text("Hello!")

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages