forked from caichengyi/BayesianLM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfg.py
36 lines (30 loc) · 945 Bytes
/
cfg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import numpy as np
import torch
import random
#Edit the Path
data_path = '/dataset/'
results_path = '/results/'
def set_seed(seed):
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
random.seed(seed)
torch.backends.cudnn.deterministic = True
def convert_models_to_fp32(model):
for p in model.parameters():
p.data = p.data.float()
if p.grad:
p.grad.data = p.grad.data.float()
config_vm = {'lr': 0.01, 'epoch': 200,
'blmp': {'lap': 1, 'topk_ratio': 0.15},
'blm': {'lap': 1},
'ft_lr': 0.1
}
config_vlm = {'lr': 40, 'epoch': 200,
'blmp': {'lap': 1, 'topk_ratio': 0.15},
'blm': {'lap': 1}
}
config_vm_fast = {'lr': 0.01, 'epoch': 200,
'blmp': {'lap': 1, 'topk_ratio': 0.15},
'blm': {'lap': 1}
}