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

您好,请问随机种子固定后,复现后每次结果都不相同是什么原因?怎么才能在随机种子相同时固定复现结果? #23

Closed
hujy025 opened this issue Mar 5, 2023 · 3 comments

Comments

@hujy025
Copy link

hujy025 commented Mar 5, 2023

No description provided.

@njcx-ai
Copy link
Contributor

njcx-ai commented Mar 5, 2023

您好,很抱歉代码中随机种子固定的策略可能有遗漏。
如果种子设置没问题的话,结果还是不一样可能是torch.backends.cudnn.benchmark的问题。这是python调用cudnn来加速卷积的一个机制。解决方法是将torch.backends.cudnn.benchmark = False,然后直接加一句torch.backends.cudnn.deterministic = True。

@yxy0102
Copy link

yxy0102 commented Mar 5, 2023

作者你好,我也遇到了这个问题,并且我在set_seed里加入了您说的那两行代码,但是每次的结果还是在变化,还有什么解决办法吗
0be97e2d9d2742328ca6456771a6854

@zxlzr
Copy link
Contributor

zxlzr commented Apr 5, 2023

您好,我建议您检查下是否还有部分参数的种子没有fix,我也不是很清楚您这种情况非常抱歉。

@zxlzr zxlzr closed this as completed Apr 9, 2023
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

4 participants