Varun Wadhwa commited on
Commit
cb88b43
·
unverified ·
1 Parent(s): 157e35b
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -86,10 +86,11 @@ def align_labels_with_tokens(label, word_ids):
86
  aligned_label_ids.append(-100)
87
  elif word_idx != previous_word_idx: # Only label the first token of a given word.
88
  if label[word_idx].startswith("B-"):
89
- print(word_idx)
90
- print(label[word_idx])
91
  label[word_idx] = label[word_idx].replace("B-", "I-")
92
- aligned_label_ids.append(label[word_idx])
 
93
  else:
94
  aligned_label_ids.append(-100)
95
  previous_word_idx = word_idx
@@ -112,7 +113,7 @@ def tokenize_function(examples):
112
  print("Printing partial input with tokenized output")
113
  print(inputs.tokens()[:1000])
114
  print(inputs.word_ids()[:1000])
115
- print(new_labels[:1000])
116
  inputs["labels"] = new_labels
117
  return inputs
118
 
 
86
  aligned_label_ids.append(-100)
87
  elif word_idx != previous_word_idx: # Only label the first token of a given word.
88
  if label[word_idx].startswith("B-"):
89
+ print("B vs I")
90
+ print(label2id[label[word_idx]])
91
  label[word_idx] = label[word_idx].replace("B-", "I-")
92
+ print(label2id[label[word_idx]])
93
+ aligned_label_ids.append(label2id[label[word_idx]])
94
  else:
95
  aligned_label_ids.append(-100)
96
  previous_word_idx = word_idx
 
113
  print("Printing partial input with tokenized output")
114
  print(inputs.tokens()[:1000])
115
  print(inputs.word_ids()[:1000])
116
+ print(new_labels[0])
117
  inputs["labels"] = new_labels
118
  return inputs
119