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

固定种子为啥还有偏差啊 #46

Open
OnlineWaAndRe opened this issue Dec 21, 2023 · 6 comments
Open

固定种子为啥还有偏差啊 #46

OnlineWaAndRe opened this issue Dec 21, 2023 · 6 comments

Comments

@OnlineWaAndRe
Copy link

前辈您好,我想问一下,为啥HGB固定了种子,但是运行五次还是有偏差啊,按道理来说固定种子结果差不多,但是我看程序运行的时候有些许偏差啊,这是为啥啊?

@1049451037
Copy link
Member

1049451037 commented Dec 21, 2023

随机种子有很多,可能要同时设置才能保证完全不随机,比如random.seed、np.random.seed、torch.random.seed等。

@OnlineWaAndRe
Copy link
Author

我给HGB种子都固定了,该固定的都固定了,咋还是有偏差啊
image

@1049451037
Copy link
Member

首先要确认你的main函数里调用了这个set_random_seed,如果确实调用了还是有偏差,那我也不太清楚了……可能是一些cuda底层的难以控制的偏差吧

@OnlineWaAndRe
Copy link
Author

确实调用了,但还是有偏差,如果是cuda底层的影响就算了。还有一个问题就是,HGB为啥不固定种子啊?而是随机跑,随机跑五次有好有坏,那这样跟随机五个种子跑好像也没什么区别。

@1049451037
Copy link
Member

是的,没区别,都可以。

@OnlineWaAndRe
Copy link
Author

好滴,感谢前辈!!!

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