jiangjiechen commited on
Commit
460c37e
1 Parent(s): 817b9ee

fix dict pop issue

Browse files
Files changed (1) hide show
  1. src/mrc_client/answer_generator.py +2 -1
src/mrc_client/answer_generator.py CHANGED
@@ -52,7 +52,8 @@ def assemble_answers_to_one(js, k=5, mask_token='<mask>', mask_rate=0.):
52
  js = json.loads(js)
53
 
54
  should_keep = random.random() > mask_rate
55
- js.pop('evidential_assembled')
 
56
  for q, answers in zip(js['cloze_qs'], js['evidential']):
57
  if mask_token in q:
58
  s = q.find(mask_token)
 
52
  js = json.loads(js)
53
 
54
  should_keep = random.random() > mask_rate
55
+ if 'evidential_assembled' in js:
56
+ js.pop('evidential_assembled')
57
  for q, answers in zip(js['cloze_qs'], js['evidential']):
58
  if mask_token in q:
59
  s = q.find(mask_token)