Skip to main content

Use torch like keras

Project description

torch4keras

licence GitHub release PyPI PyPI - Downloads GitHub stars GitHub Issues contributions welcome

Documentation | Bert4torch | Examples | Source code

1. 下载安装

安装稳定版

pip install torch4keras

安装最新版

pip install git+https://github.com/Tongjilibo/torch4keras.git

2. 功能

  • 简述:抽象出来的Trainer,适用于一般神经网络的训练,仅需关注网络结构代码

  • 特色:进度条展示训练过程,自定义metric,自带Evaluator, Checkpoint, Tensorboard, Logger等Callback,也可自定义Callback

  • 初衷:前期功能是作为bert4torchrec4torch的Trainer

  • 训练:

    2022-10-28 23:16:10 - Start Training
    2022-10-28 23:16:10 - Epoch: 1/5
    5000/5000 [==============================] - 13s 3ms/step - loss: 0.1351 - acc: 0.9601
    Evaluate: 100%|██████████████████████████████████████████████████| 2500/2500 [00:03<00:00, 798.09it/s] 
    test_acc: 0.98045. best_test_acc: 0.98045
    
    2022-10-28 23:16:27 - Epoch: 2/5
    5000/5000 [==============================] - 13s 3ms/step - loss: 0.0465 - acc: 0.9862
    Evaluate: 100%|██████████████████████████████████████████████████| 2500/2500 [00:03<00:00, 635.78it/s] 
    test_acc: 0.98280. best_test_acc: 0.98280
    
    2022-10-28 23:16:44 - Epoch: 3/5
    5000/5000 [==============================] - 15s 3ms/step - loss: 0.0284 - acc: 0.9915
    Evaluate: 100%|██████████████████████████████████████████████████| 2500/2500 [00:03<00:00, 673.60it/s] 
    test_acc: 0.98365. best_test_acc: 0.98365
    
    2022-10-28 23:17:03 - Epoch: 4/5
    5000/5000 [==============================] - 15s 3ms/step - loss: 0.0179 - acc: 0.9948
    Evaluate: 100%|██████████████████████████████████████████████████| 2500/2500 [00:03<00:00, 692.34it/s] 
    test_acc: 0.98265. best_test_acc: 0.98365
    
    2022-10-28 23:17:21 - Epoch: 5/5
    5000/5000 [==============================] - 14s 3ms/step - loss: 0.0129 - acc: 0.9958
    Evaluate: 100%|██████████████████████████████████████████████████| 2500/2500 [00:03<00:00, 701.77it/s] 
    test_acc: 0.98585. best_test_acc: 0.98585
    
    2022-10-28 23:17:37 - Finish Training
    

3. 快速上手

4. 版本历史

更新日期 版本 版本说明
20231207 0.1.6 监控fit过程,有报错则发送邮件提醒; 解决torch2.0的compile冲突问题
20230928 0.1.5 进度条中显示已经训练的时间
20230912 v0.1.4.post2 History增加plot()方法, 增加add_module()方法,修复0.1.4的_argparse_forward的bug, 增加loss2metrics方法

更多版本

5. 更新历史:

  • 20231207: 监控fit过程,有报错则发送邮件提醒; 解决torch2.0的compile冲突问题
  • 20230928: 进度条中显示已经训练的时间
  • 20230912: History增加plot()方法, 增加add_module()方法,修复0.1.4的_argparse_forward的bug, 增加loss2metrics方法

更多历史

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

torch4keras-0.1.6.tar.gz (37.7 kB view hashes)

Uploaded Source

Supported by

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