Skip to content

Commit

Permalink
Merge pull request #164 from breezedeus/dev
Browse files Browse the repository at this point in the history
fix: model downloads on Windows
  • Loading branch information
breezedeus authored Dec 17, 2024
2 parents 416ff1e + a72fb13 commit c87047b
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 130 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@ __pycache__/

# Distribution / packaging
.Python
.DS_Store
data/
models/
output-*/
outputs-*/
outputs/
*.jpg
*.jpeg
*.png
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
.idea/
lib/
lib64/
parts/
Expand Down
11 changes: 11 additions & 0 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Release Notes

# Update 2024.12.17: **V1.1.2.3** Released

Major Changes:

- Bugfix: Fixed issues related to downloading models on Windows.

主要变更:

- 修复了在 Windows 环境下下载模型的问题。


# Update 2024.12.11: **V1.1.2.2** Released

Major Changes:
Expand Down
2 changes: 1 addition & 1 deletion pix2text/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# [Pix2Text](https://github.com/breezedeus/pix2text): an Open-Source Alternative to Mathpix.
# Copyright (C) 2022-2024, [Breezedeus](https://www.breezedeus.com).

__version__ = '1.1.2.2'
__version__ = '1.1.2.3'
15 changes: 6 additions & 9 deletions pix2text/doc_xl_layout/doc_xl_layout_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
box2list,
x_overlap,
merge_boxes,
prepare_model_files2,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -124,15 +125,11 @@ def _prepare_model_files(self, root, model_info):
model_fp = model_dir / 'DocXLayout_231012.pth'
if model_fp.exists():
return model_fp
if model_dir.exists():
shutil.rmtree(str(model_dir))
model_dir.mkdir(parents=True)
download_cmd = f'huggingface-cli download --repo-type model --resume-download --local-dir-use-symlinks False breezedeus/pix2text-layout --local-dir {model_dir}'
os.system(download_cmd)
if not model_fp.exists(): # download failed above
if model_dir.exists():
shutil.rmtree(str(model_dir))
os.system('HF_ENDPOINT=https://hf-mirror.com ' + download_cmd)
model_fp = prepare_model_files2(
model_fp_or_dir=model_fp,
remote_repo="breezedeus/pix2text-layout",
file_or_dir="file",
)
return model_fp

def convert_eval_format(self, all_bboxes, opt):
Expand Down
Loading

0 comments on commit c87047b

Please sign in to comment.