danseith commited on
Commit
f51fca8
1 Parent(s): 616c8c6

Fixed simple replacement logic to account for deletion of grammer (bread. is now the same as bread)

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -177,13 +177,13 @@ def unmask(text, temp, rounds):
177
  out = {item["token_str"]: item["score"] for item in res}
178
  new_token = sample_output(out, sampling)
179
  unsuccessful_iters = 0
180
- while new_token == masked:
181
  if unsuccessful_iters > 5:
182
  break
183
  print('skipped', new_token)
184
  new_token = sample_output(out, sampling=sampling)
185
  unsuccessful_iters += 1
186
- if new_token == masked:
187
  split_text[mask_pos] = new_token
188
  else:
189
  split_text[mask_pos] = '*' + new_token + '*'
 
177
  out = {item["token_str"]: item["score"] for item in res}
178
  new_token = sample_output(out, sampling)
179
  unsuccessful_iters = 0
180
+ while masked in new_token:
181
  if unsuccessful_iters > 5:
182
  break
183
  print('skipped', new_token)
184
  new_token = sample_output(out, sampling=sampling)
185
  unsuccessful_iters += 1
186
+ if masked in new_token:
187
  split_text[mask_pos] = new_token
188
  else:
189
  split_text[mask_pos] = '*' + new_token + '*'