Unverified Commit fb6cb8b0 authored by ciaran's avatar ciaran Committed by GitHub

Update pdf_extract_kit.py

Modify line 397 to ensure compatibility with CPU execution, addressing the issue where specifying 'cpu' in config.json still results in a ValueError for expecting a cuda device but getting 'cpu' during demo execution.
parent db01bcdc
...@@ -393,7 +393,7 @@ class CustomPEKModel: ...@@ -393,7 +393,7 @@ class CustomPEKModel:
elif int(res['category_id']) in [5]: elif int(res['category_id']) in [5]:
table_res_list.append(res) table_res_list.append(res)
if torch.cuda.is_available(): if torch.cuda.is_available() and self.device != 'cpu':
properties = torch.cuda.get_device_properties(self.device) properties = torch.cuda.get_device_properties(self.device)
total_memory = properties.total_memory / (1024 ** 3) # 将字节转换为 GB total_memory = properties.total_memory / (1024 ** 3) # 将字节转换为 GB
if total_memory <= 10: if total_memory <= 10:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment