Skip to content

Commit

Permalink
Merge pull request #153 from wintermelon008/dev
Browse files Browse the repository at this point in the history
Fix bugs for quesnet_vec
  • Loading branch information
KenelmQLH committed Jan 13, 2024
2 parents 3e6204c + d65242c commit d786570
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions EduNLP/Pretrain/quesnet_vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ def _convert_to_ids(self, item: Union[str, dict, list], key=lambda x: x,
token_item = self.tokenize(item, key)
token_idx = []
for _, w in enumerate(token_item):
if isinstance(w, FigureSegment) and 'ques_figure_ids' in item.keys():
if isinstance(w, FigureSegment) and isinstance(item, dict) and 'ques_figure_ids' in item.keys():
# image

try:
fig_id = f"{w.src[10:-1]}"
fig_index = item['ques_figure_ids'].index(fig_id)

if self.img_dir != "":
if self.img_dir is not None:
fig_src = os.path.join(self.img_dir, fig_id)
if '.png' in item['ques_figure_paths'][fig_index]:
fig_src += '.png'
Expand Down

0 comments on commit d786570

Please sign in to comment.