Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
refactor(model): remove unused YOLO v11 language detection model
myhlolia80ff05150dc
diff --git a/magic_pdf/model/sub_modules/language_detection/utils.py b/magic_pdf/model/sub_modules/language_detection/utils.pyindex 5f60aa89..583e2407 100644--- a/magic_pdf/model/sub_modules/language_detection/utils.py+++ b/magic_pdf/model/sub_modules/language_detection/utils.py@@ -24,11 +24,11 @@ def get_model_config():config_path = os.path.join(model_config_dir, 'model_configs.yaml')with open(config_path, 'r', encoding='utf-8') as f:configs = yaml.load(f, Loader=yaml.FullLoader)- return local_models_dir, device, configs+ return root_dir, local_models_dir, device, configsdef get_text_images(simple_images):- local_models_dir, device, configs = get_model_config()+ _, local_models_dir, device, configs = get_model_config()atom_model_manager = AtomModelSingleton()temp_layout_model = atom_model_manager.get_atom_model(atom_model_name=AtomicModel.Layout,@@ -69,15 +69,11 @@ def model_init(model_name: str):atom_model_manager = AtomModelSingleton()if model_name == MODEL_NAME.YOLO_V11_LangDetect:- local_models_dir, device, configs = get_model_config()+ root_dir, _, device, _ = get_model_config()model = atom_model_manager.get_atom_model(atom_model_name=AtomicModel.LangDetect,langdetect_model_name=MODEL_NAME.YOLO_V11_LangDetect,- langdetect_model_weight=str(- os.path.join(- local_models_dir, configs['weights'][MODEL_NAME.YOLO_V11_LangDetect]- )- ),+ langdetect_model_weight=str(os.path.join(root_dir, 'resources', 'yolov11-langdetect', 'yolo_v11_ft.pt')),device=device,)else:diff --git a/magic_pdf/resources/model_config/model_configs.yaml b/magic_pdf/resources/model_config/model_configs.yamlindex c3c8ab3b..a11f509f 100644--- a/magic_pdf/resources/model_config/model_configs.yaml+++ b/magic_pdf/resources/model_config/model_configs.yaml@@ -5,5 +5,4 @@ weights:unimernet_small: MFR/unimernet_smallstruct_eqtable: TabRec/StructEqTabletablemaster: TabRec/TableMaster- rapid_table: TabRec/RapidTable- yolo_v11n_langdetect: LangDetect/YOLO/yolo_v11_ft.pt\ No newline at end of file+ rapid_table: TabRec/RapidTable\ No newline at end of filediff --git a/magic_pdf/resources/yolov11-langdetect/yolo_v11_ft.pt b/magic_pdf/resources/yolov11-langdetect/yolo_v11_ft.ptnew file mode 100644index 00000000..8e7dbe70Binary files /dev/null and b/magic_pdf/resources/yolov11-langdetect/yolo_v11_ft.pt differdiff --git a/projects/gradio_app/examples/complex_layout.pdf b/projects/gradio_app/examples/complex_layout.pdfindex 6813a3fd..f9d09673 100644Binary files a/projects/gradio_app/examples/complex_layout.pdf and b/projects/gradio_app/examples/complex_layout.pdf differ