Download annotations/annotation_37/AlphaRec/utils.py from mcy98/RECODE-H: direct link, hf CLI and curl.
- Browser
- Download file 415 Bytes
-
https://huggingface.co/datasets/mcy98/RECODE-H/resolve/main/annotations/annotation_37/AlphaRec/utils.py
- Command line
-
hf download hf://datasets/mcy98/RECODE-H/annotations/annotation_37/AlphaRec/utils.py
-
curl -L -o utils.py https://huggingface.co/datasets/mcy98/RECODE-H/resolve/main/annotations/annotation_37/AlphaRec/utils.py
415 Bytes
| import random | |
| import os | |
| import numpy as np | |
| import torch | |
| def fix_seeds(seed): | |
| random.seed(seed) | |
| os.environ['PYTHONHASHSEED'] = str(seed) # 为了禁止hash随机化,使得实验可复现 | |
| np.random.seed(seed) | |
| torch.manual_seed(seed) | |
| torch.cuda.manual_seed(seed) | |
| torch.cuda.manual_seed_all(seed) # if you are using multi-GPU. | |
| torch.backends.cudnn.benchmark = False | |
| torch.backends.cudnn.deterministic = True |