Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

train.py的坑:容易误删已训练模型 #89

Open
YourSonnet18 opened this issue Mar 1, 2024 · 2 comments
Open

train.py的坑:容易误删已训练模型 #89

YourSonnet18 opened this issue Mar 1, 2024 · 2 comments

Comments

@YourSonnet18
Copy link

YourSonnet18 commented Mar 1, 2024

image-ids-CTR/train.py, 一运行就会在最开始删除exp_name目录,然后创建新的。这非常容易把上次训练好的模型删掉,尤其是在想test的时候!因为没有提供test.py,看代码的意思,test用的也是train.py,只是在config中将test_only改为True。如果此时没有修改exp_name——按理说,同个实验test不会想到要修改——运行train.py就会报错未找到model.pth。一看傻眼了,被删了。。
saver()里面,一上来就
shutil.rmtree('./history/{}'.format(config['exp_name']))
即使是训练阶段,这种写法也很不安全,一不小心就会酿成大错。。。

感谢作者的贡献!

@ningyuv
Copy link

ningyuv commented Mar 1, 2024

设计上应该是每次exp用不同的exp_name

@YourSonnet18
Copy link
Author

YourSonnet18 commented Mar 1, 2024

设计上应该是每次exp用不同的exp_name

问题已补充
如果是训练阶段可以理解,但想要测试,也需要命名新的exp_name(因为看代码的意思,test用的也是train.py,只是在config中改为仅测试),这很不符合人的直觉。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants