Skip to content

Commit a14abd6

Browse files
committed
Update dependencies and improve configuration for better compatibility
1 parent 326d6f6 commit a14abd6

6 files changed

Lines changed: 18 additions & 9 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ lerna-debug.log*
99
.venv
1010
__pycache__
1111
.cache
12+
cache
1213

1314
node_modules
1415
dist

convert.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from typing import Annotated, Dict, List, Optional, Type
1212

1313
import rich.table
14+
import torch
1415
import typer
1516
from docling_core.transforms.serializer.html import (
1617
HTMLDocSerializer,
@@ -83,6 +84,12 @@
8384
console = Console()
8485
err_console = Console(stderr=True)
8586

87+
IS_MAC_ARM = sys.platform == "darwin" and platform.machine().lower() in {"arm64", "aarch64"}
88+
DEFAULT_ACCELERATOR_DEVICE = AcceleratorDevice.MPS if IS_MAC_ARM else AcceleratorDevice.AUTO
89+
90+
print("MPS built:", torch.backends.mps.is_built())
91+
print("MPS available:", torch.backends.mps.is_available())
92+
8693
ocr_factory_internal = get_ocr_factory(allow_external_plugins=False)
8794
ocr_engines_enum_internal = ocr_factory_internal.get_enum()
8895

@@ -257,7 +264,7 @@ def convert_files( # noqa: C901
257264
num_threads: Annotated[int, typer.Option(..., help="Number of threads")] = 4,
258265
device: Annotated[
259266
AcceleratorDevice, typer.Option(..., help="Accelerator device")
260-
] = AcceleratorDevice.AUTO,
267+
] = DEFAULT_ACCELERATOR_DEVICE,
261268
tempdir: Optional[str] = None
262269
) -> List[ConversionResult]:
263270
log_format = "%(asctime)s\t%(levelname)s\t%(name)s: %(message)s"

flow-docling.spec

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ from PyInstaller.utils.hooks import collect_all
44
datas = []
55
binaries = []
66
hiddenimports = []
7-
tmp_ret = collect_all('docling_parse')
8-
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
97
tmp_ret = collect_all('easyocr')
108
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
9+
tmp_ret = collect_all('transformers')
10+
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
1111
tmp_ret = collect_all('docling')
1212
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
13+
tmp_ret = collect_all('docling_parse')
14+
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
1315

1416

1517
a = Analysis(
@@ -18,7 +20,7 @@ a = Analysis(
1820
binaries=binaries,
1921
datas=datas,
2022
hiddenimports=hiddenimports,
21-
hookspath=['./hooks'],
23+
hookspath=[],
2224
hooksconfig={},
2325
runtime_hooks=[],
2426
excludes=[],

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
WEIGHTS_PATH = os.environ.get("HF_HOME", None)
2020
IMAGE_RESOLUTION_SCALE = 2.0
21-
LOCK_FILE = ".models_downloaded.lock"
21+
LOCK_FILE = ".models_downloaded.lock2"
2222
THREADS = None
2323

2424
@asynccontextmanager

poetry.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ authors = [
1010

1111

1212
[tool.poetry.dependencies]
13-
docling = ">=2.40.0,<3.0.0"
14-
pyinstaller = ">=6.14.1,<7.0.0"
13+
docling = ">=2.49.0,<3.0.0"
14+
pyinstaller = ">=6.15.0,<7.0.0"
1515
uvicorn = ">=0.35.0,<0.40.0"
1616
fastapi = ">=0.115.14,<0.120.0"
1717
einops = ">=0.8.1,<1.0.0"

0 commit comments

Comments
 (0)