Skip to content

Commit 54d661d

Browse files
committed
Separate layout and OCR models
1 parent a284743 commit 54d661d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

marker/models.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@
1010
from surya.ocr_error import OCRErrorPredictor
1111
from surya.recognition import RecognitionPredictor
1212
from surya.table_rec import TableRecPredictor
13+
from surya.settings import settings as surya_settings
1314

1415

1516
def create_model_dict(
1617
device=None, dtype=None, attention_implementation: str | None = None
1718
) -> dict:
18-
foundation_predictor = FoundationPredictor(
19-
device=device, dtype=dtype
20-
)
2119
return {
22-
"foundation_model": foundation_predictor,
23-
"layout_model": LayoutPredictor(foundation_predictor),
24-
"recognition_model": RecognitionPredictor(foundation_predictor),
20+
"layout_model": LayoutPredictor(FoundationPredictor(checkpoint=surya_settings.LAYOUT_MODEL_CHECKPOINT, attention_implementation=attention_implementation, device=device, dtype=dtype)),
21+
"recognition_model": RecognitionPredictor(FoundationPredictor(checkpoint=surya_settings.RECOGNITION_MODEL_CHECKPOINT, attention_implementation=attention_implementation, device=device, dtype=dtype)),
2522
"table_rec_model": TableRecPredictor(device=device, dtype=dtype),
2623
"detection_model": DetectionPredictor(device=device, dtype=dtype),
2724
"ocr_error_model": OCRErrorPredictor(device=device, dtype=dtype),

0 commit comments

Comments
 (0)