File size: 374 Bytes
9d21d47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import random

import numpy as np
import torch

from tasks import task_mapper


def setup_plain_seed(SEED):
    os.environ["PYTHONHASHSEED"] = str(SEED)
    random.seed(SEED)
    np.random.seed(SEED)


def setup_cpu(seed):
    os.environ["TOKENIZERS_PARALLELISM"] = "false"
    setup_plain_seed(seed)
    torch.manual_seed(seed)
    torch.random.manual_seed(seed)