Spaces:
Runtime error
Runtime error
taka-yamakoshi
commited on
Commit
·
9239cfa
1
Parent(s):
85debe8
debug
Browse files
app.py
CHANGED
@@ -137,7 +137,8 @@ def separate_options(option_locs):
|
|
137 |
return option_1_locs, option_2_locs
|
138 |
|
139 |
def mask_out(input_ids,pron_locs,option_locs,mask_id):
|
140 |
-
|
|
|
141 |
# note annotations are shifted by 1 because special tokens were omitted
|
142 |
return input_ids[:pron_locs[0]+1] + [mask_id for _ in range(len(option_locs))] + input_ids[pron_locs[-1]+2:]
|
143 |
|
|
|
137 |
return option_1_locs, option_2_locs
|
138 |
|
139 |
def mask_out(input_ids,pron_locs,option_locs,mask_id):
|
140 |
+
if len(pron_locs)>1:
|
141 |
+
assert np.all(np.diff(pron_locs)==1)
|
142 |
# note annotations are shifted by 1 because special tokens were omitted
|
143 |
return input_ids[:pron_locs[0]+1] + [mask_id for _ in range(len(option_locs))] + input_ids[pron_locs[-1]+2:]
|
144 |
|