m-ric HF Staff commited on
Commit
50b0870
Β·
1 Parent(s): 8d2fb93

Fix begin notes

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -82,13 +82,14 @@ def process_relevances(input_tokens, all_relevances, generated_tokens):
82
  current_width = 0
83
  return best_width, best_patch_start
84
 
85
- output_with_notes = [(el, None) for el in generated_tokens[:kernel_width]]
86
- for row in range(kernel_width, len(generated_tokens)):
87
- best_width, best_patch_start = find_largest_contiguous_patch(significant_areas[row-kernel_width+1])
88
  if best_width is not None:
89
  output_with_notes.append((generated_tokens[row], (best_width, best_patch_start)))
90
  else:
91
  output_with_notes.append((generated_tokens[row], None))
 
92
 
93
  # Fuse the notes for consecutive output tokens if necessary
94
  for i in range(len(output_with_notes)):
 
82
  current_width = 0
83
  return best_width, best_patch_start
84
 
85
+ output_with_notes = []
86
+ for row in range(len(generated_tokens)-kernel_width+1):
87
+ best_width, best_patch_start = find_largest_contiguous_patch(significant_areas[row])
88
  if best_width is not None:
89
  output_with_notes.append((generated_tokens[row], (best_width, best_patch_start)))
90
  else:
91
  output_with_notes.append((generated_tokens[row], None))
92
+ output_with_notes += [(el, None) for el in generated_tokens[-kernel_width+1:]]
93
 
94
  # Fuse the notes for consecutive output tokens if necessary
95
  for i in range(len(output_with_notes)):