深度学习实验跟踪和框架集成工具
Project description
SeeTrain
SeeTrain 是一个强大的深度学习实验跟踪和框架集成工具,提供统一的接口来适配各种深度学习框架,实现无缝的实验管理和数据记录。
✨ 特性
- 🔗 多框架集成 - 支持 PyTorch Lightning、TensorFlow/Keras、Hugging Face、MMEngine 等主流框架
- 📊 统一实验跟踪 - 提供一致的 API 来记录指标、图像、音频、文本等多媒体数据
- 🎯 多种适配模式 - Callback、Tracker、VisBackend、Autolog 四种集成模式
- 🚀 自动日志记录 - 支持 OpenAI、智谱 AI 等 API 的自动拦截和记录
- 📈 实时监控 - 硬件资源监控、性能指标跟踪
- 🎨 丰富可视化 - 基于 Rich 库的美观终端输出
🚀 快速开始
安装
pip install seetrain
基本使用
from seetrain import init, log, log_scalar, log_image, finish
# 初始化实验
experiment = init(
project="my_project",
experiment_name="experiment_1",
description="我的第一个实验"
)
# 记录标量指标
log_scalar('loss', 0.5, step=100)
log_scalar('accuracy', 0.95, step=100)
# 记录图像
import numpy as np
image = np.random.rand(224, 224, 3)
log_image('prediction', image, step=100)
# 记录字典数据
log({
'train/loss': 0.3,
'train/accuracy': 0.98,
'val/loss': 0.4,
'val/accuracy': 0.96
}, step=100)
# 完成实验
finish()
🔧 框架集成
PyTorch Lightning
from seetrain.integration import init_pytorch_lightning
# 初始化集成
integration = init_pytorch_lightning(
project="pytorch_project",
experiment_name="lightning_training"
)
# 获取回调函数
callback = integration.get_callback()
# 在训练器中使用
from pytorch_lightning import Trainer
trainer = Trainer(callbacks=[callback])
TensorFlow/Keras
from seetrain.integration import init_keras
# 初始化集成
integration = init_keras(
project="keras_project",
experiment_name="keras_training"
)
# 获取回调函数
callback = integration.get_callback()
# 在模型训练中使用
model.fit(
x_train, y_train,
callbacks=[callback],
epochs=10
)
Hugging Face Transformers
from seetrain.integration import init_transformers
# 初始化集成
integration = init_transformers(
project="transformers_project",
experiment_name="bert_training"
)
# 获取回调函数
callback = integration.get_callback()
# 在训练器中使用
from transformers import Trainer
trainer = Trainer(
model=model,
callbacks=[callback],
# ... 其他参数
)
API 自动日志记录
from seetrain.integration import enable_openai_autolog
# 启用 OpenAI 自动日志记录
autolog = enable_openai_autolog(
project="openai_project",
experiment_name="chat_completion"
)
# 正常使用 OpenAI API,会自动记录
import openai
response = openai.chat.completions.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": "Hello!"}],
max_tokens=100
)
# 禁用自动日志记录
autolog.disable()
📚 支持的框架
| 框架 | 集成模式 | 状态 |
|---|---|---|
| PyTorch Lightning | Callback | ✅ |
| TensorFlow/Keras | Callback | ✅ |
| Hugging Face Transformers | Callback | ✅ |
| Hugging Face Accelerate | Tracker | ✅ |
| MMEngine/MMDetection | VisBackend | ✅ |
| Ultralytics | Callback | ✅ |
| OpenAI API | Autolog | ✅ |
| 智谱 AI API | Autolog | ✅ |
| Anthropic API | Autolog | ✅ |
🛠️ 高级功能
硬件监控
from seetrain import init
from seetrain.setting import set_settings, Settings
# 配置硬件监控
settings = Settings(
hardware_monitor=True,
hardware_interval=10 # 每10秒收集一次硬件信息
)
set_settings(settings)
# 初始化实验时会自动开始硬件监控
experiment = init(project="monitored_project")
多媒体数据记录
# 记录音频
import numpy as np
audio_data = np.random.randn(16000) # 1秒的音频
log_audio('speech', audio_data, sample_rate=16000, step=100)
# 记录文本
log_text('prediction', "这是一个预测结果", step=100)
# 记录视频
video_frames = np.random.rand(10, 224, 224, 3) # 10帧视频
log_video('animation', video_frames, fps=30, step=100)
配置管理
from seetrain import update_config
# 记录超参数
update_config({
'learning_rate': 0.001,
'batch_size': 32,
'model_architecture': 'ResNet50',
'optimizer': 'Adam'
})
📦 安装选项
基础安装
pip install seetrain
特定框架支持
# PyTorch 支持
pip install seetrain[pytorch]
# TensorFlow 支持
pip install seetrain[tensorflow]
# Hugging Face 支持
pip install seetrain[transformers]
# MMEngine 支持
pip install seetrain[mmcv]
# API 集成支持
pip install seetrain[api]
# 开发依赖
pip install seetrain[dev]
# 文档依赖
pip install seetrain[docs]
🤝 贡献
我们欢迎社区贡献!请查看 CONTRIBUTING.md 了解如何参与项目开发。
📄 许可证
本项目采用 MIT 许可证。详情请查看 LICENSE 文件。
🔗 相关链接
🙏 致谢
感谢所有为 SeeTrain 项目做出贡献的开发者和社区成员!
SeeTrain - 让深度学习实验跟踪变得简单而强大!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
seetrain_ml-0.1.0.tar.gz
(8.0 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
seetrain_ml-0.1.0-py3-none-any.whl
(113.3 kB
view details)
File details
Details for the file seetrain_ml-0.1.0.tar.gz.
File metadata
- Download URL: seetrain_ml-0.1.0.tar.gz
- Upload date:
- Size: 8.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
659f3fa625f00a4576e99d5893704f0170537be3d623d385af3422ea481b2d59
|
|
| MD5 |
a1d2bac2561a72e75bb495f7c7dd0dbb
|
|
| BLAKE2b-256 |
8d5dce962cd7e72415f20067766cef2da01fc848921cee09e25f186a732e2d12
|
File details
Details for the file seetrain_ml-0.1.0-py3-none-any.whl.
File metadata
- Download URL: seetrain_ml-0.1.0-py3-none-any.whl
- Upload date:
- Size: 113.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
774908cb5a965f43aefb146f7094cdb99e33befb1397b88b91016cfab4819895
|
|
| MD5 |
a04a27efd43b0251d53280303414071b
|
|
| BLAKE2b-256 |
4670d086675dda94db703d0be2f505bc4e62396970637e27170dfc99850a9454
|