Skip to content

Commit

Permalink
fix labal2idx
Browse files Browse the repository at this point in the history
  • Loading branch information
king-menin committed Feb 13, 2019
1 parent 352fed9 commit f6dba0e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/data/bert_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,17 @@ def create(cls,

meta2idx = None
cls2idx = None
label2idx = None

if idx2label is None and os.path.exists(str(idx2label_path)):
idx2label = read_json(idx2label_path)
label2idx = {label: idx for idx, label in enumerate(idx2label)}
if is_meta and idx2meta is None and os.path.exists(str(idx2meta_path)):
idx2meta = read_json(idx2meta_path)
meta2idx = {label: idx for idx, label in enumerate(idx2meta)}
if is_cls and idx2cls is None and os.path.exists(str(idx2cls_path)):
idx2cls = read_json(idx2cls_path)
cls2idx = {label: idx for idx, label in enumerate(idx2cls)}
label2idx = {label: idx for idx, label in enumerate(idx2label)}

train_dl = None
if train_path:
Expand Down

0 comments on commit f6dba0e

Please sign in to comment.