瀏覽代碼

fix: torch dependency start error (#2777)

### What problem does this PR solve?

when use slim image, remove ```torch``` denpendency.

### Type of change

- [✓] Bug Fix (non-breaking change which fixes an issue)

---------

Co-authored-by: chongchuanbing <chongchuanbing@gmail.com>
Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
tags/v0.13.0
chongchuanbing 1 年之前
父節點
當前提交
66172cef3e
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 6 行新增3 行删除
  1. 6
    3
      deepdoc/parser/pdf_parser.py

+ 6
- 3
deepdoc/parser/pdf_parser.py 查看文件

@@ -45,9 +45,12 @@ class RAGFlowPdfParser:

self.updown_cnt_mdl = xgb.Booster()
if not LIGHTEN:
import torch
if torch.cuda.is_available():
self.updown_cnt_mdl.set_param({"device": "cuda"})
try:
import torch
if torch.cuda.is_available():
self.updown_cnt_mdl.set_param({"device": "cuda"})
except Exception as e:
logging.error(str(e))
try:
model_dir = os.path.join(
get_project_base_directory(),

Loading…
取消
儲存