nightsnack / YOLObile

This is the implementation of YOLObile: Real-Time Object Detection on Mobile Devices via Compression-Compilation Co-Design
GNU General Public License v3.0
360 stars 96 forks source link

模型文件大 #15

Open baisong666 opened 3 years ago

baisong666 commented 3 years ago

第一步训练生成的4个模型文件的大小为256M,第二步生成的模型文件大小为500M左右,请问为啥会折磨大呢,这不是要部署在手机上吗,这样大的模型文件怎麼部署呢,请作者看到后能不能回复一下,万分感谢

baisong666 commented 3 years ago

你好,可以看看我的问题吗

baisong666 commented 3 years ago

可以看看不

baisong666 commented 3 years ago

救命阿

baisong666 commented 3 years ago

help

nightsnack commented 3 years ago

看到了。第二步的模型文件里面存了还有optimizer log之类的东西所以大了。https://github.com/nightsnack/YOLObile/blob/2494a48ff3591da3b400dcb3c531a77d22d510e4/train.py#L667 ,你改一下。这里只存model。部署手机需要compiler,compiler没有开源

baisong666 commented 3 years ago

是改成torch.save(last) 和 torch.save(best)吗

baisong666 commented 3 years ago

我设置了name后,模型变成了256M,现在按照你的方法ckpt那个只有model了,模型还是256M,这又是为啥呢😂

---原始邮件--- 发件人: @.> 发送时间: 2021年7月13日(周二) 下午4:10 收件人: @.>; 抄送: @.**@.>; 主题: Re: [nightsnack/YOLObile] 模型文件大 (#15)

看到了。第二步的模型文件里面存了还有optimizer log之类的东西所以大了。https://github.com/nightsnack/YOLObile/blob/2494a48ff3591da3b400dcb3c531a77d22d510e4/train.py#L667,你改一下。这里只存model。部署手机需要compiler,compiler没有开源

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

baisong666 commented 3 years ago

chkpt = {#'epoch': epoch,

'best_fitness': best_fitness,

                         #'training_results': f.read(),
                         'model': ema.ema.module.state_dict() if hasattr(model,
                                                                         'module') else ema.ema.state_dict()
                         #'optimizer': None if final_epoch else optimizer.state_dict()
                         }
baisong666 commented 3 years ago

是这样把其他的注释掉吗

baisong666 commented 3 years ago

预训练模型选择哪一个

baisong666 commented 3 years ago

help

nightsnack commented 3 years ago

256M有什么问题吗?这是存的.pt,pruning之后sparse的model里面0也是存下来的呀。在手机上运行的时候才会重新按照index-val的方式重新存储

baisong666 commented 3 years ago

啥意思哈哈,是咱这个程序训练出来就是256M吗

baisong666 commented 3 years ago

可不可以具体说一说呢