본문 바로가기
컴퓨터과학

pytorch 코드의 재생산성을 위한 입력코드 정리하는 곳

by 홈카페주인 2023. 6. 11.
SEED = 1234

random.seed(SEED)
np.random.seed(SEED)
torch.manual_seed(SEED)
torch.cuda.manual_seed(SEED)
torch.backends.cudnn.deterministic = True

 

 

 

 

참고자료

https://hoya012.github.io/blog/reproducible_pytorch/

 

Reproducible PyTorch를 위한 randomness 올바르게 제어하기!

PyTorch 코드의 완벽한 재현을 위해 고려해야할 randomness를 제어하는 법을 설명드리겠습니다.

hoya012.github.io

https://stackoverflow.com/questions/66130547/what-does-the-difference-between-torch-backends-cudnn-deterministic-true-and

 

What does the difference between 'torch.backends.cudnn.deterministic=True' and 'torch.set_deterministic(True)'?

My network includes 'torch.nn.MaxPool3d' which throw a RuntimeError when cudnn deterministic flag is on according to the PyTorch docs (version 1.7 - https://pytorch.org/docs/stable/generated/torch.

stackoverflow.com

 

728x90

댓글