فهرست منبع

refactor(magic_pdf): remove unnecessary half() calls for CPU devices

- Remove half() calls for DocLayoutYOLO and YOLOv8 models
- This change prevents potential errors when running models on CPU
myhloli 8 ماه پیش
والد
کامیت
27281c9247

+ 0 - 2
magic_pdf/model/sub_modules/layout/doclayout_yolo/DocLayoutYOLO.py

@@ -4,8 +4,6 @@ from doclayout_yolo import YOLOv10
 class DocLayoutYOLOModel(object):
     def __init__(self, weight, device):
         self.model = YOLOv10(weight)
-        if not device.startswith("cpu"):
-            self.model.half()
         self.device = device
 
     def predict(self, image):

+ 0 - 2
magic_pdf/model/sub_modules/mfd/yolov8/YOLOv8.py

@@ -4,8 +4,6 @@ from ultralytics import YOLO
 class YOLOv8MFDModel(object):
     def __init__(self, weight, device="cpu"):
         self.mfd_model = YOLO(weight)
-        if not device.startswith("cpu"):
-            self.mfd_model.half()
         self.device = device
 
     def predict(self, image):