-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (24 loc) · 969 Bytes
/
Copy pathmain.py
File metadata and controls
30 lines (24 loc) · 969 Bytes
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
from parse import parse_args
from utils import fix_seeds
import os
import torch
if __name__ == '__main__':
args, special_args = parse_args()
print(args)
fix_seeds(args.seed) # set random seed
rs_type = args.rs_type # LLM, Seq, General, etc.
print(f'from models.{rs_type}.'+ args.model_name + ' import ' + args.model_name + '_RS')
# from models.General.UniSRec import UniSRec_RS
try:
exec(f'from models.{args.rs_type}.'+ args.model_name + ' import ' + args.model_name + '_RS') # load the model
except:
print('Model %s not implemented!' % (args.model_name))
# RS = UniSRec_RS(args, special_args)
# from models.General.IntentCF import IntentCF_RS
# RS = IntentCF_RS(args, special_args)
try:
RS = eval(args.model_name + '_RS(args, special_args)') # load the recommender system
except:
RS = eval(args.model_name + '_RS(args)')
RS.execute() # train and test
print('Done!')