Skip to content

Commit eeef2f6

Browse files
committed
load with util
1 parent 0ec37e4 commit eeef2f6

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

train.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ def train_author(model,folder,in_dict,author_dict,out_dict,volume,batch_size=102
106106
abs_vec=list(np.array(abs_vec)/abs_count)
107107

108108
author_vec=[0.0 for i in range(0,len(fa2vid))]
109-
110-
tmpf=open(folder+"/authors"+str(i)+".json",'r',encoding='utf-8')
111-
authors=json.load(tmpf)
112-
tmpf.close()
109+
authors=util.load_sups(folder+"/authors"+str(i)+".json")
113110
for author in authors:
114111
try:
115112
author_vec[fa2vid[author]]=1.0

utils/util.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import json
22

33
def load_sups(path):
4-
f=open(path,'r')
5-
cc2vid=json.load(f)
4+
f=open(path,'r',encoding='utf-8')
5+
content=json.load(f)
66
f.close()
7-
return cc2vid
7+
return content

0 commit comments

Comments
 (0)