fix: torch dependency start error (#2777)
Browse files### 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 <[email protected]>
Co-authored-by: Kevin Hu <[email protected]>
deepdoc/parser/pdf_parser.py
CHANGED
@@ -45,9 +45,12 @@ class RAGFlowPdfParser:
|
|
45 |
|
46 |
self.updown_cnt_mdl = xgb.Booster()
|
47 |
if not LIGHTEN:
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
51 |
try:
|
52 |
model_dir = os.path.join(
|
53 |
get_project_base_directory(),
|
|
|
45 |
|
46 |
self.updown_cnt_mdl = xgb.Booster()
|
47 |
if not LIGHTEN:
|
48 |
+
try:
|
49 |
+
import torch
|
50 |
+
if torch.cuda.is_available():
|
51 |
+
self.updown_cnt_mdl.set_param({"device": "cuda"})
|
52 |
+
except Exception as e:
|
53 |
+
logging.error(str(e))
|
54 |
try:
|
55 |
model_dir = os.path.join(
|
56 |
get_project_base_directory(),
|