Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions dataflow/operators/code/eval/python_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def _ensure_worker(self):
# Worker process died, restart it
try:
self.persistent_worker.terminate()
except:
except Exception:
pass
self.persistent_worker = PersistentWorker()

Expand All @@ -478,7 +478,7 @@ def _restart_worker(self):
if self.persistent_worker is not None:
try:
self.persistent_worker.terminate()
except:
except Exception:
pass
self.persistent_worker = PersistentWorker()

Expand Down Expand Up @@ -625,7 +625,7 @@ def batch_apply(self, batch_code, messages):
# If reset fails, try restarting worker
try:
self._restart_worker()
except:
except Exception:
pass
except Exception as error:
print(f"Error in batch_apply: {error}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ def organize_pics(
global_json_data = []

# read mineru content json
json_data = json.load(open(mineru_content_json_path, 'r'))
with open(mineru_content_json_path, 'r') as f:
json_data = json.load(f)

# if output_pic_folder is not exist, create it
if not os.path.exists(output_pic_folder):
Expand Down Expand Up @@ -207,7 +208,8 @@ def process_input(self,
max_page_idx = max(idx_list)

# load img_json
img_json = json.load(open(img_json_path, "r"))
with open(img_json_path, "r") as f:
img_json = json.load(f)
img_dict = {}
for item in img_json:
if item["page_idx"] not in img_dict:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def forward(
):
try: # for flash-attn latest version
hidden_states, unpad_indices, cu_seqlens, max_seqlen, _ = unpad_input(hidden_states, attention_mask)
except: # for flash-attn 2.3.3 verstion
except Exception: # for flash-attn 2.3.3 verstion
hidden_states, unpad_indices, cu_seqlens, max_seqlen = unpad_input(hidden_states, attention_mask)
unpadded_lengths = (cu_seqlens, max_seqlen)
else:
Expand Down
2 changes: 1 addition & 1 deletion dataflow/utils/pdf2vqa/format_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def refine_title(title: str, strict_title_match=False):
try:
# 优先提取阿拉伯数字章节编号(如1.1,2等)
new_title = re.search(r"\d+\.\d+|\d+", title).group()
except:
except AttributeError:
try:
# 其次提取中文数字章节编号(如六、二十四等)
new_title = re.search(r'[一二三四五六七八九零十百]+', title).group()
Expand Down
Loading