-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #369 from bbrowning/docling-tesserocr
Prefer tesserocr over easyocr, if available
- Loading branch information
Showing
6 changed files
with
154 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Standard | ||
import pathlib | ||
import typing | ||
|
||
# Third Party | ||
import pytest | ||
|
||
TESTS_PATH = pathlib.Path(__file__).parent.parent.absolute() | ||
|
||
|
||
@pytest.fixture | ||
def testdata_path() -> typing.Generator[pathlib.Path, None, None]: | ||
"""Path to local test data directory""" | ||
yield TESTS_PATH / "testdata" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Standard | ||
import pathlib | ||
import subprocess | ||
import sys | ||
|
||
|
||
def test_sdg_imports(testdata_path: pathlib.Path): | ||
script = testdata_path / "leanimports.py" | ||
subprocess.check_call([sys.executable, str(script)], text=True) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""Helper for test_sdg_imports""" | ||
|
||
# Standard | ||
import sys | ||
|
||
# block slow imports | ||
for unwanted in ["deepspeed", "llama_cpp", "torch", "transformers", "vllm"]: | ||
# importlib raises ModuleNotFound when sys.modules value is None. | ||
assert unwanted not in sys.modules | ||
sys.modules[unwanted] = None # type: ignore[assignment] | ||
|
||
# First Party | ||
# This will trigger errors if any of the import chain tries to load | ||
# the unwanted modules | ||
from instructlab.sdg.generate_data import generate_data |