diff --git a/Dockerfile b/Dockerfile index e4f7e094632316468ad68bf84b894bb4535c87e9..578058fde2fe9875d912e97662c4252ef4c76820 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,11 +8,11 @@ ENV TORCH_CUDA_ARCH_LIST=${TORCH_CUDA_ARCH_LIST} RUN --mount=type=cache,target=/root/.cache/pip \ pip install -U pip hatchling "setuptools>=68" --root-user-action ignore -COPY nemotron-ocr /workspace/nemotron-ocr -WORKDIR /workspace/nemotron-ocr +COPY nemo-retriever-ocr /workspace/nemo-retriever-ocr +WORKDIR /workspace/nemo-retriever-ocr # Ensure no prebuilt binaries/artifacts from the host are present -RUN rm -f src/nemotron_ocr_cpp/*.so || true \ +RUN rm -f src/nemo_retriever_ocr_cpp/*.so || true \ && rm -rf build/ dist/ RUN --mount=type=cache,target=/root/.cache/pip \ diff --git a/README.md b/README.md index a8cadcf89bb2a76acdecfbce78fb10c3f577a10c..660ce49d524495252ac930547a31f0dfa0d7b7e9 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ tags: - ingestion --- -# Nemotron OCR v1 +# NeMo Retriever OCR v1 ## **Model Overview** @@ -27,15 +27,15 @@ tags: ### **Description** -The Nemotron OCR v1 model is a state-of-the-art text recognition model designed for robust end-to-end optical character recognition (OCR) on complex real-world images. It integrates three core neural network modules: a detector for text region localization, a recognizer for transcription of detected regions, and a relational model for layout and structure analysis. +The NeMo Retriever OCR v1 model is a state-of-the-art text recognition model designed for robust end-to-end optical character recognition (OCR) on complex real-world images. It integrates three core neural network modules: a detector for text region localization, a recognizer for transcription of detected regions, and a relational model for layout and structure analysis. -This model is optimized for a wide variety of OCR tasks, including multi-line, multi-block, and natural scene text, and it supports advanced reading order analysis via its relational model component. Nemotron OCR v1 has been developed to be production-ready and commercially usable, with a focus on speed and accuracy on both document and natural scene images. +This model is optimized for a wide variety of OCR tasks, including multi-line, multi-block, and natural scene text, and it supports advanced reading order analysis via its relational model component. NeMo Retriever OCR v1 has been developed to be production-ready and commercially usable, with a focus on speed and accuracy on both document and natural scene images. -The Nemotron OCR v1 model is part of the NVIDIA NeMo Retriever collection of NIM microservices, which provides state-of-the-art, commercially-ready models and microservices optimized for the lowest latency and highest throughput. It features a production-ready information retrieval pipeline with enterprise support. The models that form the core of this solution have been trained using responsibly selected, auditable data sources. With multiple pre-trained models available as starting points, developers can readily customize them for domain-specific use cases, such as information technology, human resource help assistants, and research & development research assistants. +The NeMo Retriever OCR v1 model is part of the NVIDIA NeMo Retriever collection of NIM microservices, which provides state-of-the-art, commercially-ready models and microservices optimized for the lowest latency and highest throughput. It features a production-ready information retrieval pipeline with enterprise support. The models that form the core of this solution have been trained using responsibly selected, auditable data sources. With multiple pre-trained models available as starting points, developers can readily customize them for domain-specific use cases, such as information technology, human resource help assistants, and research & development research assistants. This model is ready for commercial use. -We are excited to announce the open sourcing of this commercial model. For users interested in deploying this model in production environments, it is also available via the model API in NVIDIA Inference Microservices (NIM) at [nemotron-ocr-v1](https://build.nvidia.com/nvidia/nemoretriever-ocr-v1). +We are excited to announce the open sourcing of this commercial model. For users interested in deploying this model in production environments, it is also available via the model API in NVIDIA Inference Microservices (NIM) at [nemoretriever-ocr-v1](https://build.nvidia.com/nvidia/nemoretriever-ocr-v1). ### **License/Terms of use** @@ -57,11 +57,11 @@ Global ### Use Case -The **Nemotron OCR v1** model is designed for high-accuracy and high-speed extraction of textual information from images, making it ideal for powering multimodal retrieval systems, Retrieval-Augmented Generation (RAG) pipelines, and agentic applications that require seamless integration of visual and language understanding. Its robust performance and efficiency make it an excellent choice for next-generation AI systems that demand both precision and scalability across diverse real-world content. +The **NeMo Retriever OCR v1** model is designed for high-accuracy and high-speed extraction of textual information from images, making it ideal for powering multimodal retrieval systems, Retrieval-Augmented Generation (RAG) pipelines, and agentic applications that require seamless integration of visual and language understanding. Its robust performance and efficiency make it an excellent choice for next-generation AI systems that demand both precision and scalability across diverse real-world content. ### Release Date -10/23/2025 via https://huggingface.co/nvidia/nemotron-ocr-v1 +10/23/2025 via https://huggingface.co/nvidia/nemoretriever-ocr-v1 ### References @@ -71,7 +71,7 @@ The **Nemotron OCR v1** model is designed for high-accuracy and high-speed extra **Architecture Type:** Hybrid detector–recognizer with document-level relational modeling -The Nemotron OCR v1 model integrates three specialized neural components: +The NeMo Retriever OCR v1 model integrates three specialized neural components: - **Text Detector:** Utilizes a RegNetY-8GF convolutional backbone for high-accuracy localization of text regions within images. - **Text Recognizer:** Employs a Transformer-based sequence recognizer to transcribe text from detected regions, supporting variable word and line lengths. @@ -163,11 +163,11 @@ git lfs install ``` - Using https ``` -git clone https://huggingface.co/nvidia/nemotron-ocr-v1 +git clone https://huggingface.co/nvidia/nemoretriever-ocr-v1 ``` - Or using ssh ``` -git clone git@hf.co:nvidia/nemotron-ocr-v1 +git clone git@hf.co:nvidia/nemoretriever-ocr-v1 ``` 2. Installation @@ -179,7 +179,7 @@ git clone git@hf.co:nvidia/nemotron-ocr-v1 - Run the following command to install the package: ```bash -cd nemotron-ocr +cd nemo-retriever-ocr pip install hatchling pip install -v . ``` @@ -197,7 +197,7 @@ docker run --rm --gpus all nvcr.io/nvidia/pytorch:25.09-py3 nvidia-smi - From the repo root, bring up the service to run the example against the provided image `ocr-example-image.png`: ```bash -docker compose run --rm nemotron-ocr \ +docker compose run --rm nemo-retriever-ocr \ bash -lc "python example.py ocr-example-input-1.png --merge-level paragraph" ``` @@ -212,9 +212,9 @@ Output is saved next to your input image as `-annotated.` on the host 3. Run the model using the following code: ```python -from nemotron_ocr.inference.pipeline import NemotronOCR +from nemo_retriever_ocr.inference.pipeline import NemoRetrieverOCR -ocr = NemotronOCR() +ocr = NemoRetrieverOCR() predictions = ocr("ocr-example-input-1.png") @@ -230,7 +230,7 @@ for pred in predictions: ### Software Integration **Runtime Engine(s):** -- **NeMo Nemotron OCR V1** NIM +- **NeMo Retriever Page Elements v3** NIM **Supported Hardware Microarchitecture Compatibility [List in Alphabetic Order]:** @@ -247,7 +247,7 @@ This AI model can be embedded as an Application Programming Interface (API) call ## Model Version(s): -* `nemotron-ocr-v1` +* `nemoretriever-ocr-v1` ## **Training and Evaluation Datasets:** @@ -267,7 +267,7 @@ The model is trained on a large-scale, curated mix of public and proprietary OCR ### **Evaluation Datasets** -The Nemotron OCR v1 model is evaluated on several NVIDIA internal datasets for various tasks, such as pure OCR, table content extraction, and document retrieval. +The NeMo Retriever OCR v1 model is evaluated on several NVIDIA internal datasets for various tasks, such as pure OCR, table content extraction, and document retrieval. **Data Collection Method:** Hybrid (Automated, Human, Synthetic)
**Labeling Method:** Hybrid (Automated, Human, Synthetic)
@@ -275,9 +275,9 @@ The Nemotron OCR v1 model is evaluated on several NVIDIA internal datasets for v ### **Evaluation Results** -We benchmarked Nemotron OCR v1 on internal evaluation datasets against PaddleOCR on various tasks, such as pure OCR (Character Error Rate), table content extraction (TEDS), and document retrieval (Recall@5). +We benchmarked NeMo Retriever OCR v1 on internal evaluation datasets against PaddleOCR on various tasks, such as pure OCR (Character Error Rate), table content extraction (TEDS), and document retrieval (Recall@5). -| Metric | Nemotron OCR v1 | PaddleOCR | Net change | +| Metric | NeMo Retriever OCR v1 | PaddleOCR | Net change | |-------------------------------------------|--------------------|-----------|-----------------| | Character Error Rate | 0.1633 | 0.2029 | -19.5% ✔️ | | Bag-of-character Error Rate | 0.0453 | 0.0512 | -11.5% ✔️ | diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 71bc29dc87db006f54114174921ced64500dbf7d..086d773340e2621d4f7537ffaf9a7712969d5e58 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -1,519 +1,15 @@ -Copyright "Angus Johnson" - Boost Software License 1.0 -License Text([https://sourceforge.net/p/polyclipping/code/HEAD/tree/tags/6.2.0/License.txt](https://sourceforge.net/p/polyclipping/code/HEAD/tree/tags/6.2.0/License.txt)) - -This notice applies to **clipper**. - -Copyright (c) 2010-2014 Angus Johnson - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ------ - -Copyright "Ofek Lev" - MIT License -License Text([https://github.com/pypa/hatch/blob/master/LICENSE.txt](https://github.com/pypa/hatch/blob/master/LICENSE.txt)) - -This notice applies to **hatchling**. - -Copyright (c) 2017-present Ofek Lev - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ------ - -Copyright "NumPy Developers" - BSD 3-Clause License -License Text([https://github.com/numpy/numpy/blob/main/LICENSE.txt](https://github.com/numpy/numpy/blob/main/LICENSE.txt)) - -This notice applies to **numpy**. - -Copyright (c) 2005-2023, NumPy Developers. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of the NumPy Developers nor the names of any - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------ - -Copyright "pandas Developers" - BSD 3-Clause License -License Text([https://github.com/pandas-dev/pandas/blob/main/LICENSE](https://github.com/pandas-dev/pandas/blob/main/LICENSE)) - -This notice applies to **pandas**. - -Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team -All rights reserved. - -Copyright (c) 2011-2023, The PyData Development Team -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of the pandas development team nor the names of - any contributors may be used to endorse or promote products - derived from this software without specific prior written - permission. - - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------ - -Copyright "Secret Labs AB, Fredrik Lundh, Alex Clark and contributors" - Pillow License -License Text([https://github.com/python-pillow/Pillow/blob/main/LICENSE](https://github.com/python-pillow/Pillow/blob/main/LICENSE)) - -This notice applies to **PIL (Pillow)**. - -The Python Imaging Library (PIL) is -Copyright (c) 1997-2011 by Secret Labs AB -Copyright (c) 1995-2011 by Fredrik Lundh -Copyright (c) 2010-2023 by Alex Clark and contributors - -Like PIL, Pillow is licensed under the open source HPND License: - -By obtaining, using, and/or copying this software and/or its -associated documentation, you agree that you have read, understood, -and will comply with the following terms and conditions: - -Permission to use, copy, modify, and distribute this software and -its associated documentation for any purpose and without fee is -hereby granted, provided that the above copyright notice appears in -all copies, and that both that copyright notice and this permission -notice appear in supporting documentation, and that the name of -Secret Labs AB or the author not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. - -SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD -TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- -ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR -BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY -DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -OF THIS SOFTWARE. - ------ - -Copyright "The scikit-learn developers" - BSD 3-Clause License -License Text([https://github.com/scikit-learn/scikit-learn/blob/main/COPYING](https://github.com/scikit-learn/scikit-learn/blob/main/COPYING)) - -This notice applies to **scikit-learn**. - -Copyright (c) 2007-2024 The scikit-learn developers. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of the scikit-learn developers nor the names of - any contributors may be used to endorse or promote products - derived from this software without specific prior written - permission. - - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------ - -Copyright "Jason R. Coombs" - MIT License -License Text([https://github.com/pypa/setuptools/blob/main/LICENSE](https://github.com/pypa/setuptools/blob/main/LICENSE)) - -This notice applies to **setuptools**. - -Copyright (c) 2016 Jason R. Coombs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ------ - -Copyright "Sean Gillies" - BSD 3-Clause License -License Text([https://github.com/shapely/shapely/blob/main/LICENSE.txt](https://github.com/shapely/shapely/blob/main/LICENSE.txt)) - -This notice applies to **Shapely**. - -Copyright (c) 2007, Sean Gillies. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Sean Gillies nor the names of - its contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - ------ - -Copyright "PyTorch Contributors" - BSD-style License -License Text([https://github.com/pytorch/pytorch/blob/main/LICENSE](https://github.com/pytorch/pytorch/blob/main/LICENSE)) - -This notice applies to **torch** and **torchvision**. - -Copyright (c) 2016- Facebook, Inc. (Adam Paszke) -Copyright (c) 2014- Facebook, Inc. (Soumith Chintala) -Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert) -Copyright (c) 2012-2014 DeepMind Technologies (Koray Kavukcuoglu) -Copyright (c) 2011-2012 NEC Laboratories America (Clement Farabet) -Copyright (c) 2011-2013 New York University (Antoine Bordes) -Copyright (c) 2012-2013 University of Montreal (Pascal Vincent) -Copyright (c) 2014- Google Inc. -Copyright (c) 2015- Twitter, Inc. -Copyright (c) 2015- Intel Corporation -Copyright (c) 2015- AMD Inc. -Copyright (c) 2016- Baidu, Inc. -Copyright (c) 2016- Microsoft Corporation -Copyright (c) 2017- Amazon.com, Inc. -Copyright (c) 2018- Facebook AI Research -Copyright (c) 2019- fast.ai, Inc. -Copyright (c) 2022- PyTorch Contributors -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Facebook Inc. nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------ - -Copyright "Baidu USA LLC" - Apache License 2.0 -License Text([https://github.com/bryancatanzaro/trove/blob/master/LICENSE](https://github.com/bryancatanzaro/trove/blob/master/LICENSE)) - -This notice applies to **trove**. - -Copyright 2015-2016 Baidu USA LLC. All rights reserved. - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS \ No newline at end of file +# Third Party Notices + +The scripts contained in this repository make use of the following third-party libraries: + +- [clipper](https://sourceforge.net/p/polyclipping/code/HEAD/tree/tags/6.2.0/License.txt) +- [hatchling](https://github.com/pypa/hatch/blob/master/LICENSE.txt) +- [numpy](https://github.com/numpy/numpy/blob/main/LICENSE.txt) +- [pandas](https://github.com/pandas-dev/pandas/blob/main/LICENSE) +- [Pillow](https://github.com/python-pillow/pillow/blob/main/LICENSE) +- [scikit_learn](https://github.com/scikit-learn/scikit-learn/blob/main/COPYING) +- [setuptools](https://github.com/pypa/setuptools/blob/main/LICENSE) +- [Shapely](https://github.com/shapely/shapely/blob/main/LICENSE.txt) +- [torch](https://github.com/pytorch/pytorch/blob/main/LICENSE) +- [torchvision](https://github.com/pytorch/vision/blob/main/LICENSE) +- [trove](https://github.com/bryancatanzaro/trove/blob/master/LICENSE) \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 31199c61dab616bc7539f57f86301b9ea7c72b20..7f9934447feb9e9fe9eadb53ddd356b9a9cbb845 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,5 @@ services: - nemotron-ocr: + nemo-retriever-ocr: build: context: . dockerfile: Dockerfile diff --git a/example.py b/example.py index 06b10d5baf694dcc630335e8f78de0aaeb57b08d..2a719c80e8623bc7827badb1d5cef508ec13c2e2 100644 --- a/example.py +++ b/example.py @@ -4,11 +4,11 @@ import argparse -from nemotron_ocr.inference.pipeline import NemotronOCR +from nemo_retriever_ocr.inference.pipeline import NemoRetrieverOCR def main(image_path, merge_level, no_visualize, model_dir): - ocr_pipeline = NemotronOCR() + ocr_pipeline = NemoRetrieverOCR() predictions = ocr_pipeline(image_path, merge_level=merge_level, visualize=not no_visualize) diff --git a/nemotron-ocr/cpp/.gitattributes b/nemo-retriever-ocr/cpp/.gitattributes similarity index 100% rename from nemotron-ocr/cpp/.gitattributes rename to nemo-retriever-ocr/cpp/.gitattributes diff --git a/nemotron-ocr/cpp/.gitignore b/nemo-retriever-ocr/cpp/.gitignore similarity index 100% rename from nemotron-ocr/cpp/.gitignore rename to nemo-retriever-ocr/cpp/.gitignore diff --git a/nemotron-ocr/cpp/.gitmodules b/nemo-retriever-ocr/cpp/.gitmodules similarity index 100% rename from nemotron-ocr/cpp/.gitmodules rename to nemo-retriever-ocr/cpp/.gitmodules diff --git a/nemotron-ocr/cpp/README.md b/nemo-retriever-ocr/cpp/README.md similarity index 100% rename from nemotron-ocr/cpp/README.md rename to nemo-retriever-ocr/cpp/README.md diff --git a/nemotron-ocr/cpp/beam_decode/beam_decode.cpp b/nemo-retriever-ocr/cpp/beam_decode/beam_decode.cpp similarity index 100% rename from nemotron-ocr/cpp/beam_decode/beam_decode.cpp rename to nemo-retriever-ocr/cpp/beam_decode/beam_decode.cpp diff --git a/nemotron-ocr/cpp/beam_decode/beam_decode.h b/nemo-retriever-ocr/cpp/beam_decode/beam_decode.h similarity index 100% rename from nemotron-ocr/cpp/beam_decode/beam_decode.h rename to nemo-retriever-ocr/cpp/beam_decode/beam_decode.h diff --git a/nemotron-ocr/cpp/beam_decode/kn_lm.cpp b/nemo-retriever-ocr/cpp/beam_decode/kn_lm.cpp similarity index 100% rename from nemotron-ocr/cpp/beam_decode/kn_lm.cpp rename to nemo-retriever-ocr/cpp/beam_decode/kn_lm.cpp diff --git a/nemotron-ocr/cpp/beam_decode/kn_lm.h b/nemo-retriever-ocr/cpp/beam_decode/kn_lm.h similarity index 100% rename from nemotron-ocr/cpp/beam_decode/kn_lm.h rename to nemo-retriever-ocr/cpp/beam_decode/kn_lm.h diff --git a/nemotron-ocr/cpp/beam_decode/language_model.cpp b/nemo-retriever-ocr/cpp/beam_decode/language_model.cpp similarity index 100% rename from nemotron-ocr/cpp/beam_decode/language_model.cpp rename to nemo-retriever-ocr/cpp/beam_decode/language_model.cpp diff --git a/nemotron-ocr/cpp/beam_decode/language_model.h b/nemo-retriever-ocr/cpp/beam_decode/language_model.h similarity index 100% rename from nemotron-ocr/cpp/beam_decode/language_model.h rename to nemo-retriever-ocr/cpp/beam_decode/language_model.h diff --git a/nemotron-ocr/cpp/beam_decode/log_sum_exp.cpp b/nemo-retriever-ocr/cpp/beam_decode/log_sum_exp.cpp similarity index 100% rename from nemotron-ocr/cpp/beam_decode/log_sum_exp.cpp rename to nemo-retriever-ocr/cpp/beam_decode/log_sum_exp.cpp diff --git a/nemotron-ocr/cpp/beam_decode/log_sum_exp.h b/nemo-retriever-ocr/cpp/beam_decode/log_sum_exp.h similarity index 100% rename from nemotron-ocr/cpp/beam_decode/log_sum_exp.h rename to nemo-retriever-ocr/cpp/beam_decode/log_sum_exp.h diff --git a/nemotron-ocr/cpp/beam_decode/ngram_lm_base.cpp b/nemo-retriever-ocr/cpp/beam_decode/ngram_lm_base.cpp similarity index 100% rename from nemotron-ocr/cpp/beam_decode/ngram_lm_base.cpp rename to nemo-retriever-ocr/cpp/beam_decode/ngram_lm_base.cpp diff --git a/nemotron-ocr/cpp/beam_decode/ngram_lm_base.h b/nemo-retriever-ocr/cpp/beam_decode/ngram_lm_base.h similarity index 100% rename from nemotron-ocr/cpp/beam_decode/ngram_lm_base.h rename to nemo-retriever-ocr/cpp/beam_decode/ngram_lm_base.h diff --git a/nemotron-ocr/cpp/beam_decode/prefix.cpp b/nemo-retriever-ocr/cpp/beam_decode/prefix.cpp similarity index 100% rename from nemotron-ocr/cpp/beam_decode/prefix.cpp rename to nemo-retriever-ocr/cpp/beam_decode/prefix.cpp diff --git a/nemotron-ocr/cpp/beam_decode/prefix.h b/nemo-retriever-ocr/cpp/beam_decode/prefix.h similarity index 100% rename from nemotron-ocr/cpp/beam_decode/prefix.h rename to nemo-retriever-ocr/cpp/beam_decode/prefix.h diff --git a/nemotron-ocr/cpp/beam_decode/sbo_lm.cpp b/nemo-retriever-ocr/cpp/beam_decode/sbo_lm.cpp similarity index 100% rename from nemotron-ocr/cpp/beam_decode/sbo_lm.cpp rename to nemo-retriever-ocr/cpp/beam_decode/sbo_lm.cpp diff --git a/nemotron-ocr/cpp/beam_decode/sbo_lm.h b/nemo-retriever-ocr/cpp/beam_decode/sbo_lm.h similarity index 100% rename from nemotron-ocr/cpp/beam_decode/sbo_lm.h rename to nemo-retriever-ocr/cpp/beam_decode/sbo_lm.h diff --git a/nemotron-ocr/cpp/better_grid_sample/cpu_indirect_grid_sample.cpp b/nemo-retriever-ocr/cpp/better_grid_sample/cpu_indirect_grid_sample.cpp similarity index 100% rename from nemotron-ocr/cpp/better_grid_sample/cpu_indirect_grid_sample.cpp rename to nemo-retriever-ocr/cpp/better_grid_sample/cpu_indirect_grid_sample.cpp diff --git a/nemotron-ocr/cpp/better_grid_sample/gpu_grid_sample_utils.cuh b/nemo-retriever-ocr/cpp/better_grid_sample/gpu_grid_sample_utils.cuh similarity index 100% rename from nemotron-ocr/cpp/better_grid_sample/gpu_grid_sample_utils.cuh rename to nemo-retriever-ocr/cpp/better_grid_sample/gpu_grid_sample_utils.cuh diff --git a/nemotron-ocr/cpp/better_grid_sample/gpu_indirect_grid_sample.cu b/nemo-retriever-ocr/cpp/better_grid_sample/gpu_indirect_grid_sample.cu similarity index 100% rename from nemotron-ocr/cpp/better_grid_sample/gpu_indirect_grid_sample.cu rename to nemo-retriever-ocr/cpp/better_grid_sample/gpu_indirect_grid_sample.cu diff --git a/nemotron-ocr/cpp/better_grid_sample/grid_sample.h b/nemo-retriever-ocr/cpp/better_grid_sample/grid_sample.h similarity index 100% rename from nemotron-ocr/cpp/better_grid_sample/grid_sample.h rename to nemo-retriever-ocr/cpp/better_grid_sample/grid_sample.h diff --git a/nemotron-ocr/cpp/common.cpp b/nemo-retriever-ocr/cpp/common.cpp similarity index 100% rename from nemotron-ocr/cpp/common.cpp rename to nemo-retriever-ocr/cpp/common.cpp diff --git a/nemotron-ocr/cpp/common.h b/nemo-retriever-ocr/cpp/common.h similarity index 100% rename from nemotron-ocr/cpp/common.h rename to nemo-retriever-ocr/cpp/common.h diff --git a/nemotron-ocr/cpp/cuda_intellisense.cuh b/nemo-retriever-ocr/cpp/cuda_intellisense.cuh similarity index 100% rename from nemotron-ocr/cpp/cuda_intellisense.cuh rename to nemo-retriever-ocr/cpp/cuda_intellisense.cuh diff --git a/nemotron-ocr/cpp/geometry.h b/nemo-retriever-ocr/cpp/geometry.h similarity index 100% rename from nemotron-ocr/cpp/geometry.h rename to nemo-retriever-ocr/cpp/geometry.h diff --git a/nemotron-ocr/cpp/geometry_api/calc_poly_min_rrect.cpp b/nemo-retriever-ocr/cpp/geometry_api/calc_poly_min_rrect.cpp similarity index 100% rename from nemotron-ocr/cpp/geometry_api/calc_poly_min_rrect.cpp rename to nemo-retriever-ocr/cpp/geometry_api/calc_poly_min_rrect.cpp diff --git a/nemotron-ocr/cpp/geometry_api/geometry_api.cpp b/nemo-retriever-ocr/cpp/geometry_api/geometry_api.cpp similarity index 100% rename from nemotron-ocr/cpp/geometry_api/geometry_api.cpp rename to nemo-retriever-ocr/cpp/geometry_api/geometry_api.cpp diff --git a/nemotron-ocr/cpp/geometry_api/geometry_api.h b/nemo-retriever-ocr/cpp/geometry_api/geometry_api.h similarity index 100% rename from nemotron-ocr/cpp/geometry_api/geometry_api.h rename to nemo-retriever-ocr/cpp/geometry_api/geometry_api.h diff --git a/nemotron-ocr/cpp/geometry_api/geometry_api_common.h b/nemo-retriever-ocr/cpp/geometry_api/geometry_api_common.h similarity index 100% rename from nemotron-ocr/cpp/geometry_api/geometry_api_common.h rename to nemo-retriever-ocr/cpp/geometry_api/geometry_api_common.h diff --git a/nemotron-ocr/cpp/geometry_api/geometry_api_gpu.cu b/nemo-retriever-ocr/cpp/geometry_api/geometry_api_gpu.cu similarity index 100% rename from nemotron-ocr/cpp/geometry_api/geometry_api_gpu.cu rename to nemo-retriever-ocr/cpp/geometry_api/geometry_api_gpu.cu diff --git a/nemotron-ocr/cpp/geometry_api/get_rel_continuation_cos.cpp b/nemo-retriever-ocr/cpp/geometry_api/get_rel_continuation_cos.cpp similarity index 100% rename from nemotron-ocr/cpp/geometry_api/get_rel_continuation_cos.cpp rename to nemo-retriever-ocr/cpp/geometry_api/get_rel_continuation_cos.cpp diff --git a/nemotron-ocr/cpp/geometry_api/matrix2x2.h b/nemo-retriever-ocr/cpp/geometry_api/matrix2x2.h similarity index 100% rename from nemotron-ocr/cpp/geometry_api/matrix2x2.h rename to nemo-retriever-ocr/cpp/geometry_api/matrix2x2.h diff --git a/nemotron-ocr/cpp/geometry_api/poly_bounds_quad.cpp b/nemo-retriever-ocr/cpp/geometry_api/poly_bounds_quad.cpp similarity index 100% rename from nemotron-ocr/cpp/geometry_api/poly_bounds_quad.cpp rename to nemo-retriever-ocr/cpp/geometry_api/poly_bounds_quad.cpp diff --git a/nemotron-ocr/cpp/graph_detection/encode_util.cpp b/nemo-retriever-ocr/cpp/graph_detection/encode_util.cpp similarity index 100% rename from nemotron-ocr/cpp/graph_detection/encode_util.cpp rename to nemo-retriever-ocr/cpp/graph_detection/encode_util.cpp diff --git a/nemotron-ocr/cpp/graph_detection/encode_util.h b/nemo-retriever-ocr/cpp/graph_detection/encode_util.h similarity index 100% rename from nemotron-ocr/cpp/graph_detection/encode_util.h rename to nemo-retriever-ocr/cpp/graph_detection/encode_util.h diff --git a/nemotron-ocr/cpp/half_ops.cu b/nemo-retriever-ocr/cpp/half_ops.cu similarity index 100% rename from nemotron-ocr/cpp/half_ops.cu rename to nemo-retriever-ocr/cpp/half_ops.cu diff --git a/nemotron-ocr/cpp/half_ops.cuh b/nemo-retriever-ocr/cpp/half_ops.cuh similarity index 100% rename from nemotron-ocr/cpp/half_ops.cuh rename to nemo-retriever-ocr/cpp/half_ops.cuh diff --git a/nemotron-ocr/cpp/local_ips/local_ips.h b/nemo-retriever-ocr/cpp/local_ips/local_ips.h similarity index 100% rename from nemotron-ocr/cpp/local_ips/local_ips.h rename to nemo-retriever-ocr/cpp/local_ips/local_ips.h diff --git a/nemotron-ocr/cpp/local_ips/quad_all_2_all_dist_v2.cu b/nemo-retriever-ocr/cpp/local_ips/quad_all_2_all_dist_v2.cu similarity index 100% rename from nemotron-ocr/cpp/local_ips/quad_all_2_all_dist_v2.cu rename to nemo-retriever-ocr/cpp/local_ips/quad_all_2_all_dist_v2.cu diff --git a/nemotron-ocr/cpp/module.cpp b/nemo-retriever-ocr/cpp/module.cpp similarity index 100% rename from nemotron-ocr/cpp/module.cpp rename to nemo-retriever-ocr/cpp/module.cpp diff --git a/nemotron-ocr/cpp/non_maximal_suppression/cpu_non_maximal_suppression.cpp b/nemo-retriever-ocr/cpp/non_maximal_suppression/cpu_non_maximal_suppression.cpp similarity index 100% rename from nemotron-ocr/cpp/non_maximal_suppression/cpu_non_maximal_suppression.cpp rename to nemo-retriever-ocr/cpp/non_maximal_suppression/cpu_non_maximal_suppression.cpp diff --git a/nemotron-ocr/cpp/non_maximal_suppression/cuda_non_maximal_suppression.cu b/nemo-retriever-ocr/cpp/non_maximal_suppression/cuda_non_maximal_suppression.cu similarity index 100% rename from nemotron-ocr/cpp/non_maximal_suppression/cuda_non_maximal_suppression.cu rename to nemo-retriever-ocr/cpp/non_maximal_suppression/cuda_non_maximal_suppression.cu diff --git a/nemotron-ocr/cpp/non_maximal_suppression/nms_common.h b/nemo-retriever-ocr/cpp/non_maximal_suppression/nms_common.h similarity index 100% rename from nemotron-ocr/cpp/non_maximal_suppression/nms_common.h rename to nemo-retriever-ocr/cpp/non_maximal_suppression/nms_common.h diff --git a/nemotron-ocr/cpp/non_maximal_suppression/nms_kd_tree.h b/nemo-retriever-ocr/cpp/non_maximal_suppression/nms_kd_tree.h similarity index 100% rename from nemotron-ocr/cpp/non_maximal_suppression/nms_kd_tree.h rename to nemo-retriever-ocr/cpp/non_maximal_suppression/nms_kd_tree.h diff --git a/nemotron-ocr/cpp/non_maximal_suppression/non_maximal_suppression.cpp b/nemo-retriever-ocr/cpp/non_maximal_suppression/non_maximal_suppression.cpp similarity index 100% rename from nemotron-ocr/cpp/non_maximal_suppression/non_maximal_suppression.cpp rename to nemo-retriever-ocr/cpp/non_maximal_suppression/non_maximal_suppression.cpp diff --git a/nemotron-ocr/cpp/non_maximal_suppression/non_maximal_suppression.h b/nemo-retriever-ocr/cpp/non_maximal_suppression/non_maximal_suppression.h similarity index 100% rename from nemotron-ocr/cpp/non_maximal_suppression/non_maximal_suppression.h rename to nemo-retriever-ocr/cpp/non_maximal_suppression/non_maximal_suppression.h diff --git a/nemotron-ocr/cpp/non_maximal_suppression/strided_quad.h b/nemo-retriever-ocr/cpp/non_maximal_suppression/strided_quad.h similarity index 100% rename from nemotron-ocr/cpp/non_maximal_suppression/strided_quad.h rename to nemo-retriever-ocr/cpp/non_maximal_suppression/strided_quad.h diff --git a/nemotron-ocr/cpp/promote.h b/nemo-retriever-ocr/cpp/promote.h similarity index 100% rename from nemotron-ocr/cpp/promote.h rename to nemo-retriever-ocr/cpp/promote.h diff --git a/nemotron-ocr/cpp/quad_rectify/quad_rectify.h b/nemo-retriever-ocr/cpp/quad_rectify/quad_rectify.h similarity index 100% rename from nemotron-ocr/cpp/quad_rectify/quad_rectify.h rename to nemo-retriever-ocr/cpp/quad_rectify/quad_rectify.h diff --git a/nemotron-ocr/cpp/quad_rectify/quad_rectify_cpu.cpp b/nemo-retriever-ocr/cpp/quad_rectify/quad_rectify_cpu.cpp similarity index 100% rename from nemotron-ocr/cpp/quad_rectify/quad_rectify_cpu.cpp rename to nemo-retriever-ocr/cpp/quad_rectify/quad_rectify_cpu.cpp diff --git a/nemotron-ocr/cpp/quad_rectify/quad_rectify_cpu.h b/nemo-retriever-ocr/cpp/quad_rectify/quad_rectify_cpu.h similarity index 100% rename from nemotron-ocr/cpp/quad_rectify/quad_rectify_cpu.h rename to nemo-retriever-ocr/cpp/quad_rectify/quad_rectify_cpu.h diff --git a/nemotron-ocr/cpp/quad_rectify/quad_rectify_gpu.cu b/nemo-retriever-ocr/cpp/quad_rectify/quad_rectify_gpu.cu similarity index 100% rename from nemotron-ocr/cpp/quad_rectify/quad_rectify_gpu.cu rename to nemo-retriever-ocr/cpp/quad_rectify/quad_rectify_gpu.cu diff --git a/nemotron-ocr/cpp/quad_rectify/quad_rectify_gpu.h b/nemo-retriever-ocr/cpp/quad_rectify/quad_rectify_gpu.h similarity index 100% rename from nemotron-ocr/cpp/quad_rectify/quad_rectify_gpu.h rename to nemo-retriever-ocr/cpp/quad_rectify/quad_rectify_gpu.h diff --git a/nemotron-ocr/cpp/quad_rectify/quad_rectify_shared.h b/nemo-retriever-ocr/cpp/quad_rectify/quad_rectify_shared.h similarity index 100% rename from nemotron-ocr/cpp/quad_rectify/quad_rectify_shared.h rename to nemo-retriever-ocr/cpp/quad_rectify/quad_rectify_shared.h diff --git a/nemotron-ocr/cpp/scope_timer.h b/nemo-retriever-ocr/cpp/scope_timer.h similarity index 100% rename from nemotron-ocr/cpp/scope_timer.h rename to nemo-retriever-ocr/cpp/scope_timer.h diff --git a/nemotron-ocr/cpp/sparse_select/sparse_select.cpp b/nemo-retriever-ocr/cpp/sparse_select/sparse_select.cpp similarity index 100% rename from nemotron-ocr/cpp/sparse_select/sparse_select.cpp rename to nemo-retriever-ocr/cpp/sparse_select/sparse_select.cpp diff --git a/nemotron-ocr/cpp/sparse_select/sparse_select.h b/nemo-retriever-ocr/cpp/sparse_select/sparse_select.h similarity index 100% rename from nemotron-ocr/cpp/sparse_select/sparse_select.h rename to nemo-retriever-ocr/cpp/sparse_select/sparse_select.h diff --git a/nemotron-ocr/cpp/text_region_grouping/dense_relations_to_graph.cpp b/nemo-retriever-ocr/cpp/text_region_grouping/dense_relations_to_graph.cpp similarity index 100% rename from nemotron-ocr/cpp/text_region_grouping/dense_relations_to_graph.cpp rename to nemo-retriever-ocr/cpp/text_region_grouping/dense_relations_to_graph.cpp diff --git a/nemotron-ocr/cpp/text_region_grouping/text_region_grouping.cpp b/nemo-retriever-ocr/cpp/text_region_grouping/text_region_grouping.cpp similarity index 100% rename from nemotron-ocr/cpp/text_region_grouping/text_region_grouping.cpp rename to nemo-retriever-ocr/cpp/text_region_grouping/text_region_grouping.cpp diff --git a/nemotron-ocr/cpp/text_region_grouping/text_region_grouping.h b/nemo-retriever-ocr/cpp/text_region_grouping/text_region_grouping.h similarity index 100% rename from nemotron-ocr/cpp/text_region_grouping/text_region_grouping.h rename to nemo-retriever-ocr/cpp/text_region_grouping/text_region_grouping.h diff --git a/nemotron-ocr/cpp/third_party/clipper/clipper.cpp b/nemo-retriever-ocr/cpp/third_party/clipper/clipper.cpp similarity index 100% rename from nemotron-ocr/cpp/third_party/clipper/clipper.cpp rename to nemo-retriever-ocr/cpp/third_party/clipper/clipper.cpp diff --git a/nemotron-ocr/cpp/third_party/clipper/clipper.hpp b/nemo-retriever-ocr/cpp/third_party/clipper/clipper.hpp similarity index 100% rename from nemotron-ocr/cpp/third_party/clipper/clipper.hpp rename to nemo-retriever-ocr/cpp/third_party/clipper/clipper.hpp diff --git a/nemotron-ocr/cpp/trove/LICENSE b/nemo-retriever-ocr/cpp/trove/LICENSE similarity index 100% rename from nemotron-ocr/cpp/trove/LICENSE rename to nemo-retriever-ocr/cpp/trove/LICENSE diff --git a/nemotron-ocr/cpp/trove/README.md b/nemo-retriever-ocr/cpp/trove/README.md similarity index 100% rename from nemotron-ocr/cpp/trove/README.md rename to nemo-retriever-ocr/cpp/trove/README.md diff --git a/nemotron-ocr/cpp/trove/doc/contiguous.png b/nemo-retriever-ocr/cpp/trove/doc/contiguous.png similarity index 100% rename from nemotron-ocr/cpp/trove/doc/contiguous.png rename to nemo-retriever-ocr/cpp/trove/doc/contiguous.png diff --git a/nemotron-ocr/cpp/trove/doc/random.png b/nemo-retriever-ocr/cpp/trove/doc/random.png similarity index 100% rename from nemotron-ocr/cpp/trove/doc/random.png rename to nemo-retriever-ocr/cpp/trove/doc/random.png diff --git a/nemotron-ocr/cpp/trove/doc/transpose.png b/nemo-retriever-ocr/cpp/trove/doc/transpose.png similarity index 100% rename from nemotron-ocr/cpp/trove/doc/transpose.png rename to nemo-retriever-ocr/cpp/trove/doc/transpose.png diff --git a/nemotron-ocr/cpp/trove/tests/Makefile b/nemo-retriever-ocr/cpp/trove/tests/Makefile similarity index 100% rename from nemotron-ocr/cpp/trove/tests/Makefile rename to nemo-retriever-ocr/cpp/trove/tests/Makefile diff --git a/nemotron-ocr/cpp/trove/tests/benchmark.cu b/nemo-retriever-ocr/cpp/trove/tests/benchmark.cu similarity index 100% rename from nemotron-ocr/cpp/trove/tests/benchmark.cu rename to nemo-retriever-ocr/cpp/trove/tests/benchmark.cu diff --git a/nemotron-ocr/cpp/trove/tests/block.cu b/nemo-retriever-ocr/cpp/trove/tests/block.cu similarity index 100% rename from nemotron-ocr/cpp/trove/tests/block.cu rename to nemo-retriever-ocr/cpp/trove/tests/block.cu diff --git a/nemotron-ocr/cpp/trove/tests/timer.h b/nemo-retriever-ocr/cpp/trove/tests/timer.h similarity index 100% rename from nemotron-ocr/cpp/trove/tests/timer.h rename to nemo-retriever-ocr/cpp/trove/tests/timer.h diff --git a/nemotron-ocr/cpp/trove/trove/aos.h b/nemo-retriever-ocr/cpp/trove/trove/aos.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/aos.h rename to nemo-retriever-ocr/cpp/trove/trove/aos.h diff --git a/nemotron-ocr/cpp/trove/trove/array.h b/nemo-retriever-ocr/cpp/trove/trove/array.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/array.h rename to nemo-retriever-ocr/cpp/trove/trove/array.h diff --git a/nemotron-ocr/cpp/trove/trove/block.h b/nemo-retriever-ocr/cpp/trove/trove/block.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/block.h rename to nemo-retriever-ocr/cpp/trove/trove/block.h diff --git a/nemotron-ocr/cpp/trove/trove/detail/dismember.h b/nemo-retriever-ocr/cpp/trove/trove/detail/dismember.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/detail/dismember.h rename to nemo-retriever-ocr/cpp/trove/trove/detail/dismember.h diff --git a/nemotron-ocr/cpp/trove/trove/detail/fallback.h b/nemo-retriever-ocr/cpp/trove/trove/detail/fallback.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/detail/fallback.h rename to nemo-retriever-ocr/cpp/trove/trove/detail/fallback.h diff --git a/nemotron-ocr/cpp/trove/trove/memory.h b/nemo-retriever-ocr/cpp/trove/trove/memory.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/memory.h rename to nemo-retriever-ocr/cpp/trove/trove/memory.h diff --git a/nemotron-ocr/cpp/trove/trove/print_array.h b/nemo-retriever-ocr/cpp/trove/trove/print_array.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/print_array.h rename to nemo-retriever-ocr/cpp/trove/trove/print_array.h diff --git a/nemotron-ocr/cpp/trove/trove/ptr.h b/nemo-retriever-ocr/cpp/trove/trove/ptr.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/ptr.h rename to nemo-retriever-ocr/cpp/trove/trove/ptr.h diff --git a/nemotron-ocr/cpp/trove/trove/rotate.h b/nemo-retriever-ocr/cpp/trove/trove/rotate.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/rotate.h rename to nemo-retriever-ocr/cpp/trove/trove/rotate.h diff --git a/nemotron-ocr/cpp/trove/trove/shfl.h b/nemo-retriever-ocr/cpp/trove/trove/shfl.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/shfl.h rename to nemo-retriever-ocr/cpp/trove/trove/shfl.h diff --git a/nemotron-ocr/cpp/trove/trove/static_gcd.h b/nemo-retriever-ocr/cpp/trove/trove/static_gcd.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/static_gcd.h rename to nemo-retriever-ocr/cpp/trove/trove/static_gcd.h diff --git a/nemotron-ocr/cpp/trove/trove/static_mod_inverse.h b/nemo-retriever-ocr/cpp/trove/trove/static_mod_inverse.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/static_mod_inverse.h rename to nemo-retriever-ocr/cpp/trove/trove/static_mod_inverse.h diff --git a/nemotron-ocr/cpp/trove/trove/transpose.h b/nemo-retriever-ocr/cpp/trove/trove/transpose.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/transpose.h rename to nemo-retriever-ocr/cpp/trove/trove/transpose.h diff --git a/nemotron-ocr/cpp/trove/trove/utility.h b/nemo-retriever-ocr/cpp/trove/trove/utility.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/utility.h rename to nemo-retriever-ocr/cpp/trove/trove/utility.h diff --git a/nemotron-ocr/cpp/trove/trove/warp.h b/nemo-retriever-ocr/cpp/trove/trove/warp.h similarity index 100% rename from nemotron-ocr/cpp/trove/trove/warp.h rename to nemo-retriever-ocr/cpp/trove/trove/warp.h diff --git a/nemotron-ocr/hatch_build.py b/nemo-retriever-ocr/hatch_build.py similarity index 91% rename from nemotron-ocr/hatch_build.py rename to nemo-retriever-ocr/hatch_build.py index 308aa9ae8c1067ac6f6e846e18a103e5a956b81b..8e2151fa8dad55cc94b14d19cfc88735c50a7eb6 100644 --- a/nemotron-ocr/hatch_build.py +++ b/nemo-retriever-ocr/hatch_build.py @@ -15,12 +15,12 @@ def _extension_up_to_date(project_root: Path) -> bool: """Return True if a built .so exists and is newer than all sources. Respects the following directories: - - src/nemotron_ocr_cpp (Python shim and built .so location) + - src/nemo_retriever_ocr_cpp (Python shim and built .so location) - cpp/ (C++/CUDA sources) - scripts/ (build script) """ - extension_dir = project_root / "src" / "nemotron_ocr_cpp" - candidates = list(extension_dir.glob("_nemotron_ocr_cpp*.so")) + extension_dir = project_root / "src" / "nemo_retriever_ocr_cpp" + candidates = list(extension_dir.glob("_nemo_retriever_ocr_cpp*.so")) if not candidates: return False diff --git a/nemotron-ocr/pyproject.toml b/nemo-retriever-ocr/pyproject.toml similarity index 82% rename from nemotron-ocr/pyproject.toml rename to nemo-retriever-ocr/pyproject.toml index dcf96055926f5bb7d36c10a7a1de489c742bec8f..49e733131701324b30fc4651a48672fb17189c03 100644 --- a/nemotron-ocr/pyproject.toml +++ b/nemo-retriever-ocr/pyproject.toml @@ -1,8 +1,8 @@ [project] -name = "nemotron-ocr" +name = "nemo-retriever-ocr" version = "1.0.0" -description = "Nemoton OCR" -authors = [{ name = "NVIDIA Nemotron" }] +description = "NeMo Retriever OCR" +authors = [{ name = "NVIDIA NeMo Retriever" }] requires-python = ">=3.12,<3.13" dependencies = [ "pandas>=2.3.3", @@ -30,8 +30,8 @@ build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] packages = [ - "src/nemotron_ocr", - "src/nemotron_ocr_cpp", + "src/nemo_retriever_ocr", + "src/nemo_retriever_ocr_cpp", ] [tool.hatch.build.targets.wheel.hooks.custom] diff --git a/nemotron-ocr/scripts/build-extension.py b/nemo-retriever-ocr/scripts/build-extension.py similarity index 94% rename from nemotron-ocr/scripts/build-extension.py rename to nemo-retriever-ocr/scripts/build-extension.py index 19f241bd48e87a3bf80b663c2ecd6675d5c25d62..266d6e8bf8f5c19573533a7178d93bff4145f77f 100644 --- a/nemotron-ocr/scripts/build-extension.py +++ b/nemo-retriever-ocr/scripts/build-extension.py @@ -104,14 +104,14 @@ def build() -> None: ext_modules = [ CUDAExtension( - "_nemotron_ocr_cpp", + "_nemo_retriever_ocr_cpp", files, extra_compile_args=compile_args, libraries=libs, ) ] - distribution = Distribution({"name": "nemotron_ocr_cpp", "ext_modules": ext_modules}) + distribution = Distribution({"name": "nemo_retriever_ocr_cpp", "ext_modules": ext_modules}) build_ext = BuildExtension.with_options(parallel=False) cmd = build_ext(distribution) @@ -121,7 +121,7 @@ def build() -> None: # Copy built extensions back to the project for output in cmd.get_outputs(): output = Path(output) - relative_extension = Path("src/nemotron_ocr_cpp") / output.relative_to(cmd.build_lib) + relative_extension = Path("src/nemo_retriever_ocr_cpp") / output.relative_to(cmd.build_lib) shutil.copyfile(output, relative_extension) mode = os.stat(relative_extension).st_mode diff --git a/nemotron-ocr/src/nemotron_ocr/inference/__init__.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/__init__.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/__init__.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/__init__.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/encoders/__init__.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/__init__.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/encoders/__init__.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/__init__.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/encoders/base.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/base.py similarity index 94% rename from nemotron-ocr/src/nemotron_ocr/inference/encoders/base.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/base.py index 820f297110767d89dc7d06efc3f076dd9c6a290b..a3d31175400574e01c489e387b2b23f0a9b99232 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/encoders/base.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/base.py @@ -8,10 +8,10 @@ import logging import warnings import torch -from nemotron_ocr.inference.post_processing.data.text_region import Batch, TextRegion -from nemotron_ocr.inference.post_processing.data.worker_messages import TargetEncoderMessage +from nemo_retriever_ocr.inference.post_processing.data.text_region import Batch, TextRegion +from nemo_retriever_ocr.inference.post_processing.data.worker_messages import TargetEncoderMessage -from nemotron_ocr.inference.models.utils import is_named_tuple +from nemo_retriever_ocr.inference.models.utils import is_named_tuple _PREPARED_KEY = "_prepared_base" diff --git a/nemotron-ocr/src/nemotron_ocr/inference/encoders/recognizer_encoder.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/recognizer_encoder.py similarity index 97% rename from nemotron-ocr/src/nemotron_ocr/inference/encoders/recognizer_encoder.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/recognizer_encoder.py index fd6c73248beec4418229ef201bdeb4a3a7002af1..7987e06e4589c9580b099fffc2b7834d7ec3784d 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/encoders/recognizer_encoder.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/recognizer_encoder.py @@ -16,19 +16,19 @@ from typing import Tuple, List, Optional, Callable, Dict import numpy as np import torch -import nemotron_ocr.inference.post_processing.data.text_region as tr -from nemotron_ocr.inference.post_processing.data.quadrangle import Quadrangle -from nemotron_ocr.inference.post_processing.data.worker_messages import TargetEncoderMessage -from nemotron_ocr.inference.encoders.base import TargetEncoderBase +import nemo_retriever_ocr.inference.post_processing.data.text_region as tr +from nemo_retriever_ocr.inference.post_processing.data.quadrangle import Quadrangle +from nemo_retriever_ocr.inference.post_processing.data.worker_messages import TargetEncoderMessage +from nemo_retriever_ocr.inference.encoders.base import TargetEncoderBase -from nemotron_ocr_cpp import ( +from nemo_retriever_ocr_cpp import ( beam_decode, sparse_select, create_sbo_lm, decode_sequences, create_token_mapping, ) -from nemotron_ocr.inference.models.utils import ( +from nemo_retriever_ocr.inference.models.utils import ( f_measure, tensor_all_reduce, tensor_all_gather, diff --git a/nemotron-ocr/src/nemotron_ocr/inference/encoders/relational_encoder.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/relational_encoder.py similarity index 97% rename from nemotron-ocr/src/nemotron_ocr/inference/encoders/relational_encoder.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/relational_encoder.py index 4dffdc1efe15acfb2d60a2bb1886c6c79de89870..bfe364c170832f0164f6b905504a60edaf72e44c 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/encoders/relational_encoder.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/encoders/relational_encoder.py @@ -12,12 +12,12 @@ import math import torch -from nemotron_ocr.inference.post_processing.data.quadrangle import Quadrangle -import nemotron_ocr.inference.post_processing.data.text_region as tr -from nemotron_ocr.inference.encoders.base import TargetEncoderBase -from nemotron_ocr.inference.models.utils import cat +from nemo_retriever_ocr.inference.post_processing.data.quadrangle import Quadrangle +import nemo_retriever_ocr.inference.post_processing.data.text_region as tr +from nemo_retriever_ocr.inference.encoders.base import TargetEncoderBase +from nemo_retriever_ocr.inference.models.utils import cat -from nemotron_ocr_cpp import dense_relations_to_graph as cpp_dense_relations_to_graph +from nemo_retriever_ocr_cpp import dense_relations_to_graph as cpp_dense_relations_to_graph logger = logging.getLogger(__name__) logging.getLogger("shapely.geos").setLevel(logging.FATAL) diff --git a/nemotron-ocr/src/nemotron_ocr/inference/models/__init__.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/__init__.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/models/__init__.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/__init__.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/models/blocks.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/blocks.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/models/blocks.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/blocks.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/models/detector/__init__.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/detector/__init__.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/models/detector/__init__.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/detector/__init__.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/models/detector/aspp.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/detector/aspp.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/models/detector/aspp.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/detector/aspp.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/models/detector/fots_detector.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/detector/fots_detector.py similarity index 98% rename from nemotron-ocr/src/nemotron_ocr/inference/models/detector/fots_detector.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/detector/fots_detector.py index 1e59fe54e5230a5c8e089391733969a5d40956df..2d672fdeaa339d54bb1058c6380eb6e84db46086 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/models/detector/fots_detector.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/detector/fots_detector.py @@ -10,8 +10,8 @@ import torch.nn.functional as F import math -from nemotron_ocr.inference.models.detector.aspp import ASPP -from nemotron_ocr.inference.models.detector import regnet +from nemo_retriever_ocr.inference.models.detector.aspp import ASPP +from nemo_retriever_ocr.inference.models.detector import regnet logger = logging.getLogger(__name__) diff --git a/nemotron-ocr/src/nemotron_ocr/inference/models/detector/regnet.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/detector/regnet.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/models/detector/regnet.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/detector/regnet.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/models/recognizer.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/recognizer.py similarity index 97% rename from nemotron-ocr/src/nemotron_ocr/inference/models/recognizer.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/recognizer.py index 07c3069c7590a0c928e8fc0f1c165047eaa60337..b563a13594ddb92e5daa618f1d46024e2b3571e6 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/models/recognizer.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/recognizer.py @@ -7,7 +7,7 @@ from typing import Optional import torch import torch.nn as nn -from nemotron_ocr.inference.models import blocks +from nemo_retriever_ocr.inference.models import blocks logger = logging.getLogger(__name__) diff --git a/nemotron-ocr/src/nemotron_ocr/inference/models/relational.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/relational.py similarity index 98% rename from nemotron-ocr/src/nemotron_ocr/inference/models/relational.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/relational.py index e12774a4abf42e487f6f51cb6cd73edb1c5265d5..8e50dd3a4903fa3c961b24eb230e9caff340c05d 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/models/relational.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/relational.py @@ -7,10 +7,10 @@ import math import torch import torch.nn as nn -from nemotron_ocr.inference.models import blocks -from nemotron_ocr.inference.models.utils import options +from nemo_retriever_ocr.inference.models import blocks +from nemo_retriever_ocr.inference.models.utils import options -from nemotron_ocr_cpp import ( +from nemo_retriever_ocr_cpp import ( quad_rectify_calc_quad_width, ragged_quad_all_2_all_distance_v2, ) diff --git a/nemotron-ocr/src/nemotron_ocr/inference/models/utils.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/utils.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/models/utils.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/models/utils.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/pipeline.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/pipeline.py similarity index 93% rename from nemotron-ocr/src/nemotron_ocr/inference/pipeline.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/pipeline.py index 45b6c276c66c7687a5748c822b5b63ed2d566c50..2c772e195c5f8fe472b55a19d239e2d0ea051d94 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/pipeline.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/pipeline.py @@ -10,17 +10,17 @@ from pathlib import Path import numpy as np import torch import torch.nn.functional as F -from nemotron_ocr.inference.encoders.recognizer_encoder import RecognitionTargetEncoder -from nemotron_ocr.inference.encoders.relational_encoder import RelationalTargetEncoder -from nemotron_ocr.inference.models.detector.fots_detector import FOTSDetector -from nemotron_ocr.inference.models.recognizer import TransformerRecognizer -from nemotron_ocr.inference.models.relational import GlobalRelationalModel -from nemotron_ocr.inference.post_processing.indirect_grid_sample import IndirectGridSample -from nemotron_ocr.inference.post_processing.data.text_region import TextBlock -from nemotron_ocr.inference.post_processing.quad_rectify import QuadRectify -from nemotron_ocr.inference.post_processing.research_ops import parse_relational_results, reorder_boxes -from nemotron_ocr.inference.pre_processing import interpolate_and_pad, pad_to_square -from nemotron_ocr_cpp import quad_non_maximal_suppression, region_counts_to_indices, rrect_to_quads +from nemo_retriever_ocr.inference.encoders.recognizer_encoder import RecognitionTargetEncoder +from nemo_retriever_ocr.inference.encoders.relational_encoder import RelationalTargetEncoder +from nemo_retriever_ocr.inference.models.detector.fots_detector import FOTSDetector +from nemo_retriever_ocr.inference.models.recognizer import TransformerRecognizer +from nemo_retriever_ocr.inference.models.relational import GlobalRelationalModel +from nemo_retriever_ocr.inference.post_processing.indirect_grid_sample import IndirectGridSample +from nemo_retriever_ocr.inference.post_processing.data.text_region import TextBlock +from nemo_retriever_ocr.inference.post_processing.quad_rectify import QuadRectify +from nemo_retriever_ocr.inference.post_processing.research_ops import parse_relational_results, reorder_boxes +from nemo_retriever_ocr.inference.pre_processing import interpolate_and_pad, pad_to_square +from nemo_retriever_ocr_cpp import quad_non_maximal_suppression, region_counts_to_indices, rrect_to_quads from PIL import Image, ImageDraw, ImageFont from torch import amp from torchvision.io import read_image, decode_image @@ -37,7 +37,7 @@ MERGE_LEVELS = {"word", "sentence", "paragraph"} DEFAULT_MERGE_LEVEL = "paragraph" -class NemotronOCR: +class NemoRetrieverOCR: """ A high-level pipeline for performing OCR on images. """ diff --git a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/__init__.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/__init__.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/post_processing/__init__.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/__init__.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/data_container.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/data_container.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/data_container.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/data_container.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/quadrangle.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/quadrangle.py similarity index 98% rename from nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/quadrangle.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/quadrangle.py index 51946e89641652b8da0cef64eedd7c6c0004d2fc..eb7ff1f3e778754854a62e417e450971dd7d1fdc 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/quadrangle.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/quadrangle.py @@ -10,7 +10,7 @@ from shapely.geometry import Polygon import numpy import torch -from nemotron_ocr_cpp import calc_poly_min_rrect, get_poly_bounds_quad +from nemo_retriever_ocr_cpp import calc_poly_min_rrect, get_poly_bounds_quad logger = logging.getLogger(__name__) diff --git a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/relation_graph.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/relation_graph.py similarity index 98% rename from nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/relation_graph.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/relation_graph.py index 68f9d0d5082b745e493f8b61a81093b7677fb0b3..d633ecb8b7bc5b74d82d3c1915e865e052ca6295 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/relation_graph.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/relation_graph.py @@ -11,7 +11,7 @@ if TYPE_CHECKING: import torch -from nemotron_ocr_cpp import get_rel_continuation_cos as _get_rel_continuation_cos +from nemo_retriever_ocr_cpp import get_rel_continuation_cos as _get_rel_continuation_cos NEW_LINE_THRESHOLD = math.cos(80 / 180 * math.pi) diff --git a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/text_region.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/text_region.py similarity index 96% rename from nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/text_region.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/text_region.py index 2d92e77a6360e90fce3190c640003eeb2dbe9e46..8efb2a63fc838624971a40dde62bc3333cc40bae 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/text_region.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/text_region.py @@ -7,11 +7,11 @@ from typing import List, Iterator, Optional import torch -from nemotron_ocr.inference.post_processing.data.data_container import DataContainer -from nemotron_ocr.inference.post_processing.data.quadrangle import Quadrangle -from nemotron_ocr.inference.post_processing.data.relation_graph import RelationGraph +from nemo_retriever_ocr.inference.post_processing.data.data_container import DataContainer +from nemo_retriever_ocr.inference.post_processing.data.quadrangle import Quadrangle +from nemo_retriever_ocr.inference.post_processing.data.relation_graph import RelationGraph -from nemotron_ocr_cpp import text_region_grouping +from nemo_retriever_ocr_cpp import text_region_grouping HEUR_HORIZONTAL_TOLERANCE = 2.0 diff --git a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/worker_messages.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/worker_messages.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/post_processing/data/worker_messages.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/data/worker_messages.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/indirect_grid_sample.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/indirect_grid_sample.py similarity index 97% rename from nemotron-ocr/src/nemotron_ocr/inference/post_processing/indirect_grid_sample.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/indirect_grid_sample.py index 601e1cff9ab19e89133e16cbfe46ada800268464..449df49a6756acde7e26a15a999e4ccf35137424 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/indirect_grid_sample.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/indirect_grid_sample.py @@ -5,7 +5,7 @@ import logging import torch from torch.autograd import Function -from nemotron_ocr_cpp import ( +from nemo_retriever_ocr_cpp import ( indirect_grid_sample_forward, indirect_grad_sample_backward, ) diff --git a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/quad_rectify.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/quad_rectify.py similarity index 98% rename from nemotron-ocr/src/nemotron_ocr/inference/post_processing/quad_rectify.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/quad_rectify.py index ecf4e65ae611798a7e505238f67c55816f4f783b..879ab3b21e7e6fe6fc2ab0fcf166df6bdd49cede 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/quad_rectify.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/quad_rectify.py @@ -3,7 +3,7 @@ import torch from torch.autograd import Function -from nemotron_ocr_cpp import ( +from nemo_retriever_ocr_cpp import ( quad_rectify_backward, quad_rectify_calc_quad_width, quad_rectify_forward, diff --git a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/research_ops.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/research_ops.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/post_processing/research_ops.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/research_ops.py diff --git a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/rrect_to_quads.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/rrect_to_quads.py similarity index 91% rename from nemotron-ocr/src/nemotron_ocr/inference/post_processing/rrect_to_quads.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/rrect_to_quads.py index 810952aa43075b5bbca37edaad76f61ce276390b..bb398261c26dc570eead52205c394f6a7ccf734d 100644 --- a/nemotron-ocr/src/nemotron_ocr/inference/post_processing/rrect_to_quads.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/post_processing/rrect_to_quads.py @@ -3,7 +3,7 @@ import torch from torch.autograd import Function -from nemotron_ocr_cpp import rrect_to_quads, rrect_to_quads_backward +from nemo_retriever_ocr_cpp import rrect_to_quads, rrect_to_quads_backward class RRectToQuadsFunction(Function): diff --git a/nemotron-ocr/src/nemotron_ocr/inference/pre_processing.py b/nemo-retriever-ocr/src/nemo_retriever_ocr/inference/pre_processing.py similarity index 100% rename from nemotron-ocr/src/nemotron_ocr/inference/pre_processing.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr/inference/pre_processing.py diff --git a/nemotron-ocr/src/nemotron_ocr_cpp/__init__.py b/nemo-retriever-ocr/src/nemo_retriever_ocr_cpp/__init__.py similarity index 87% rename from nemotron-ocr/src/nemotron_ocr_cpp/__init__.py rename to nemo-retriever-ocr/src/nemo_retriever_ocr_cpp/__init__.py index 0d86574ffeacc184062faf6123395ef0e1ee4186..992b924c4a0b2ab3d35c75533d92a62929af53d6 100644 --- a/nemotron-ocr/src/nemotron_ocr_cpp/__init__.py +++ b/nemo-retriever-ocr/src/nemo_retriever_ocr_cpp/__init__.py @@ -9,4 +9,4 @@ try: except Exception: # torch may be cpu-only/cuda-only, still attempt import of extension pass -from ._nemotron_ocr_cpp import * # noqa: F403 \ No newline at end of file +from ._nemo_retriever_ocr_cpp import * # noqa: F403 \ No newline at end of file diff --git a/nemotron-ocr/tests/test_nms.py b/nemo-retriever-ocr/tests/test_nms.py similarity index 93% rename from nemotron-ocr/tests/test_nms.py rename to nemo-retriever-ocr/tests/test_nms.py index b913719b64d339e3a3a3b3f8097e0d05ccde4c1b..4e8935031aa2195fb9fc7adb8b7bda5624fa76ba 100644 --- a/nemotron-ocr/tests/test_nms.py +++ b/nemo-retriever-ocr/tests/test_nms.py @@ -3,7 +3,7 @@ import torch -from nemotron_ocr_cpp import quad_non_maximal_suppression +from nemo_retriever_ocr_cpp import quad_non_maximal_suppression quads = [ [[0, 2], [2, 2], [2, 0], [0, 0]], diff --git a/nemotron-ocr/tests/test_quad_rectify.py b/nemo-retriever-ocr/tests/test_quad_rectify.py similarity index 98% rename from nemotron-ocr/tests/test_quad_rectify.py rename to nemo-retriever-ocr/tests/test_quad_rectify.py index 8c10b48c414fca53f9568aff0a28c07210935c4c..9839d5c5f6653e9fb7133ad3454b38585623b568 100644 --- a/nemotron-ocr/tests/test_quad_rectify.py +++ b/nemo-retriever-ocr/tests/test_quad_rectify.py @@ -9,7 +9,7 @@ from torch.autograd import gradcheck from torchvision.transforms import ToTensor, ToPILImage from PIL import Image -from nemotron_ocr.inference.post_processing.quad_rectify import QuadRectify +from nemo_retriever_ocr.inference.post_processing.quad_rectify import QuadRectify example = 3 isotropic = True diff --git a/nemotron-ocr/tests/test_rrect_to_quads.py b/nemo-retriever-ocr/tests/test_rrect_to_quads.py similarity index 88% rename from nemotron-ocr/tests/test_rrect_to_quads.py rename to nemo-retriever-ocr/tests/test_rrect_to_quads.py index cc495675a25dc7383eef15c273ce3664ba397ec1..836ca782330183d0f97592f774f66d6159dcfa0a 100644 --- a/nemotron-ocr/tests/test_rrect_to_quads.py +++ b/nemo-retriever-ocr/tests/test_rrect_to_quads.py @@ -7,7 +7,7 @@ import torch from torch.autograd import gradcheck -from nemotron_ocr.inference.post_processing.rrect_to_quads import RRectToQuads +from nemo_retriever_ocr.inference.post_processing.rrect_to_quads import RRectToQuads def get_rrects(b, h, w): diff --git a/nemotron-ocr/uv.lock b/nemo-retriever-ocr/uv.lock similarity index 99% rename from nemotron-ocr/uv.lock rename to nemo-retriever-ocr/uv.lock index 1403f1a4ffe02f00676b4d4a6c053e6dae4f09ca..6f497319f98b6d1ebfd9e221704e18404685a1af 100644 --- a/nemotron-ocr/uv.lock +++ b/nemo-retriever-ocr/uv.lock @@ -221,7 +221,7 @@ wheels = [ ] [[package]] -name = "nemotron-ocr" +name = "nemo-retriever-ocr" version = "1.2.0.dev2" source = { editable = "." } dependencies = [ diff --git a/pixi.toml b/pixi.toml index ac71a8eb7557830f3a0a5fbddf4a2038d4512e34..f3da6f1b23cdc56dc085f1b136571a84c626b969 100644 --- a/pixi.toml +++ b/pixi.toml @@ -1,7 +1,7 @@ [workspace] authors = ["Charles Blackmon-Luca <20627856+charlesbluca@users.noreply.github.com>"] channels = ["conda-forge", "nvidia"] -name = "nemotron-ocr" +name = "nemo-retriever-ocr" platforms = ["linux-64"] version = "0.1.0" diff --git a/quickstart.md b/quickstart.md index 366fbe4302420872f003e2e00f207af6ce331c66..2628af5119b8674ed542eb6f6e37a16c8059aaa6 100644 --- a/quickstart.md +++ b/quickstart.md @@ -14,27 +14,27 @@ Create pixi environment and enter activated shell: pixi s ``` -Create a virtualenv and install nemotron-ocr into it via `uv`: +Create a virtualenv and install nemo-retriever-ocr into it via `uv`: ```bash uv venv \ -&& uv pip install -e ./nemotron-ocr -v +&& uv pip install -e ./nemo-retriever-ocr -v ``` Assert that OCR inference libraries can now be imported successfully: ```bash -uv run python -c "import nemotron_ocr; import nemotron_ocr_cpp" +uv run python -c "import nemo_retriever_ocr; import nemo_retriever_ocr_cpp" ``` ## Usage -`nemotron_ocr.inference.pipeline.NemotronOCR` is the main entry point for performing OCR inference; it can be used to iterate over predictions for a given input image: +`nemo_retriever_ocr.inference.pipeline.NemoRetrieverOCR` is the main entry point for performing OCR inference; it can be used to iterate over predictions for a given input image: ```python -from nemotron_ocr.inference.pipeline import NemotronOCR +from nemo_retriever_ocr.inference.pipeline import NemoRetrieverOCR -ocr = NemotronOCR() +ocr = NemoRetrieverOCR() predictions = ocr("ocr-example-input-1.png")