Skip to main content

A tool for monitoring model checkpoints and sending notifications

Project description

auto_model_monitor

监视模型训练时生成的权重文件,符合条件时发送QQ邮件通知。

使用场景

当你希望在模型训练过程中,当某个指标(例如验证集上的损失或准确率)低于/高于预设阈值时收到邮件通知。这有助于你及时了解模型的性能表现,以便进行必要的调整。

如何使用

安装依赖

pip install auto_model_monitor

获取QQ授权码

为了给QQ邮箱发送邮件,你需要使用授权码而不是密码。你可以在QQ邮箱的设置中找到它。

https://service.mail.qq.com/detail/0/75

Alt text

示例代码

上述配置后,你就可以使用代码了。

测试代码在tests/test.py

from auto_model_monitor import ModelMonitor, MonitorConfig, CustomParser

# 自定义解析器(TODO: 替换为你的自定义解析器')
parser = CustomParser(pattern=r'val_loss_([0-9.]+)_')

# 配置参数
config = MonitorConfig(
    watch_dir='./quicktest/logs',     # 监控的文件夹路径
    threshold=0.004,                  # 阈值
    sender='2109695291@qq.com',       # 发送邮箱
    receiver='2109695291@qq.com',     # 接收邮箱
    auth_code='xxxx',                 # 邮箱授权码(TODO: 替换为你的授权码')
    check_interval=5,                 # 检查间隔 (秒)
    log_dir='model_monitor_logs',     # 日志文件夹路径
    comparison_mode='lower',          # 比较模式
    parser=parser                     # 使用自定义解析器
)

# 初始化并启动监控器
monitor = ModelMonitor(config)
monitor.start_monitoring()

注意: 你需要修改解析器,以及你自己的邮箱授权码。

当你的模型权重文件中的分数低于或高于阈值时,你将收到邮件通知。例如:

Alt text

开发日志

2025-07-04 更新:

  • 最初版本发布。

2025-07-05 更新:

  • 代码重构。如果你需要重构前的代码,在tests/quicktest中查看。
  • 代码打包,上传PyPI。
  • 由于model_monitor这个名字已经被占用,改为auto_model_monitor

PyPI库版本

v0.1.0

  • 基础版本

v0.1.1

  • 代码重构

v0.1.2

  • 完善README.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auto_model_monitor-0.1.2.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auto_model_monitor-0.1.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file auto_model_monitor-0.1.2.tar.gz.

File metadata

  • Download URL: auto_model_monitor-0.1.2.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for auto_model_monitor-0.1.2.tar.gz
Algorithm Hash digest
SHA256 209e74852a0920a3baefb108e1cc0d44ecc3ffb1fb516cfd59f22f86638e5890
MD5 38b95044d433f59839f26ee99ee23504
BLAKE2b-256 8077a447c3bf170e71e875562fa8cd1985a5e0ca8deff475e601ae3ee21ad4ff

See more details on using hashes here.

File details

Details for the file auto_model_monitor-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for auto_model_monitor-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5fa9735157820ad33bc889765a824f02c9cf77975c4d170d7fb234919eb1478f
MD5 9692e896a5874a87bb704c256e360c16
BLAKE2b-256 ba90ffec134896d698d6ab87d9819dbca8d5dd443144d2ac43822238d843c3d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page