lyuwenyu / RT-DETR

[CVPR 2024] Official RT-DETR (RTDETR paddle pytorch), Real-Time DEtection TRansformer, DETRs Beat YOLOs on Real-time Object Detection. 🔥 🔥 🔥
Apache License 2.0
2.18k stars 237 forks source link

关于随机数种子 #368

Open 20231211 opened 1 month ago

20231211 commented 1 month ago

你好,我在dist.py中看到这段代码 def set_seed(seed):

fix the seed for reproducibility

seed = seed + get_rank()
torch.manual_seed(seed)
np.random.seed(seed)
random.seed(seed)

但似乎程序中没有调用这段代码,我需要复刻实验结果,但跑出的实验结果已经不同了😭

lyuwenyu commented 1 month ago

之前确实没写seed的逻辑 参考这个PR吧

https://github.com/lyuwenyu/RT-DETR/pull/370

20231211 commented 1 month ago

@lyuwenyu 请问这句是为什么seed = seed + get_rank()

20231211 commented 1 month ago

如果用多张GPU跑,是否需要设置torch.cuda.manual_seed_all(seed)