Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs for quesnet_vec #153

Merged
merged 2 commits into from
Jan 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading