Last active
October 22, 2021 07:53
-
-
Save YiLi225/d3dde9820b3c734c8b8ebc839a6a7e96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 6. Set random seed | |
def reset_random_seeds(CUR_SEED=1234): | |
os.environ['PYTHONHASHSEED']=str(CUR_SEED) | |
tensorflow.random.set_seed(CUR_SEED) | |
numpy.random.seed(CUR_SEED) | |
random.seed(CUR_SEED) | |
torch.manual_seed(CUR_SEED) | |
torch.cuda.manual_seed(CUR_SEED) | |
torch.cuda.manual_seed_all(CUR_SEED) | |
torch.backends.cudnn.deterministic = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment