fix: Refactor RapidOcrModel to support all PP-OCR languages via version/backbone resolution - #3863
Open
nikos-livathinos wants to merge 9 commits into
Open
fix: Refactor RapidOcrModel to support all PP-OCR languages via version/backbone resolution#3863nikos-livathinos wants to merge 9 commits into
nikos-livathinos wants to merge 9 commits into
Conversation
…te OCR models Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
Contributor
|
✅ DCO Check Passed Thanks @nikos-livathinos, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
dolfim-ibm
reviewed
Jul 24, 2026
…the model supports. This changes the way how the user's input for the language/backbone resolves to which PPOCR checkpoints should be used. Improve the tests Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
…nly when the artifacts_path is set. Otherwise delegate the downloading and local caching to the RapidOCR library. This way the package bundled model artifacts can be also used. Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
nikos-livathinos
marked this pull request as ready for review
July 27, 2026 14:55
nikos-livathinos
marked this pull request as draft
July 27, 2026 14:55
Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
nikos-livathinos
marked this pull request as ready for review
July 28, 2026 15:02
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reworks how
RapidOcrModelmaps a user's requested language and backend onto concrete PP-OCR checkpoints, so Docling can serve every language RapidOCR supports instead of justchinese/english.Previously the model shipped hand-maintained per-language, per-backend model-path tables that were hard to extend and effectively capped support at a couple of languages. This PR replaces them with a resolver that picks the right PP-OCR version and recognizer for a given
(lang, backend)pair and fetches assets on demand.Resolution procedure:
RapidOCR/python/rapidocr/utils/model_resolver.pyto check if the language is supported in PPOCRv6:a. First pass the input language through the
COMMON_LANG_ALIASES.get(input_lang, input_lang)b. Check if the output of a exists in
PP_OCRV6_LANGSa. If the input language is in:
arabic, cyrillic, devanagari, ka, korean, latin, ta, tedownload the PPOCR-v4 checkpoints. Return.
b. Else raise exception that the asked language is not supported by that backbone
a. If the language input is any of:
arabic, ch, cyrillic, devanagari, el, en, eslav, korean, latin, ta, te, thdownload the PPOCR-v5 checkpoints. Return.
b. Else raise exception that the asked language is not supported by that backbone
RapidOCR model artifacts download:
artifacts_paththe downloading is fully delegated to RapidOCR lib:In case the user has provided custom paths for each individual model (det/rec/cls), they are used instead.
Checklist: