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

torchkeras怎么按step保存 #3

Open
terminator123 opened this issue Aug 22, 2023 · 3 comments
Open

torchkeras怎么按step保存 #3

terminator123 opened this issue Aug 22, 2023 · 3 comments

Comments

@terminator123
Copy link

还有个问题想请教下,你知道torchkeras怎么按n个step进行报错吗,大模型跑一遍epoch太久了,有时候中间step的结果更好

@necrophagists
Copy link
Owner

kerasmodel.fit()加个参数patience=X 就是加入早停机制,默认是验证loss如果连续X个step没有下降就停止;如果你要实现n个step保存的话建议看一下torchkeras里调用save_ckpt的部分并修改,应该是加个步数的判断就行了。

@terminator123
Copy link
Author

kerasmodel.fit()加个参数patience=X 就是加入早停机制,默认是验证loss如果连续X个step没有下降就停止;如果你要实现n个step保存的话建议看一下torchkeras里调用save_ckpt的部分并修改,应该是加个步数的判断就行了。

patience=x,这个是x个epoch吧。。。save_ckpt那部分我看了下,一是没有step这个参数,另外是我没找到它实际的调用入口啊

@necrophagists
Copy link
Owner

抱歉 确实是epoch 然后我看了一下 https://github.com/lyhue1991/torchkeras/blob/master/torchkeras/kerasmodel.py 我觉得你可以把KerasModel里的save_ckpt方法传入EpochRunner 然后在EpochRunner中加个判断就行了 EpochRunner有step

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