File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 6
6
from tqdm import tqdm
7
7
from modules .utils import read_json , save_json
8
8
import logging
9
+ import os
9
10
10
11
11
12
class InputFeatures (object ):
@@ -448,12 +449,12 @@ def create(cls,
448
449
meta2idx = None
449
450
cls2idx = None
450
451
451
- if idx2label is None and idx2label_path is not None :
452
+ if idx2label is None and os . path . exists ( str ( idx2label_path )) :
452
453
idx2label = read_json (idx2label_path )
453
- if is_meta and idx2meta is None and idx2meta_path is not None :
454
+ if is_meta and idx2meta is None and os . path . exists ( str ( idx2meta_path )) :
454
455
idx2meta = read_json (idx2meta_path )
455
456
meta2idx = {label : idx for idx , label in enumerate (idx2meta )}
456
- if is_cls and idx2cls is None and idx2cls_path is not None :
457
+ if is_cls and idx2cls is None and os . path . exists ( str ( idx2cls_path )) :
457
458
idx2cls = read_json (idx2cls_path )
458
459
cls2idx = {label : idx for idx , label in enumerate (idx2cls )}
459
460
387D
label2idx = {label : idx for idx , label in enumerate (idx2label )}
You can’t perform that action at this time.
0 commit comments