GGUF conversion of Logics-MLLM/Logics-Parsing-V3 (Alibaba, Apache-2.0) for llama.cpp, plus a small pipeline that turns PDFs/images into Markdown with tables (HTML) and cropped figures without vLLM — for Windows/WSL machines with a CPU or an old 2 GB GPU.
This is an unofficial community conversion. All credit for the model goes to the original authors.
| File | Size | Description |
|---|---|---|
logics-v3-q8_0.gguf |
812 MB | Language model, Q8_0 |
mmproj-logics-v3-q8_0.gguf |
116 MB | Vision encoder/projector, Q8_0 |
inference_v3.py |
Upstream prompts, pre/post-processing (unmodified, from alibaba/Logics-Parsing) | |
download_model.py |
Upstream HF/ModelScope downloader (unmodified) | |
llamacpp_backend.py |
New: engine that sends the upstream prompts to a llama.cpp server | |
parse_doc.py |
New: resumable whole-document parsing (one page per window, upstream long-document prompt) | |
inference_cpu.py |
New: transformers CPU fallback (no vLLM), much slower | |
scripts/ |
Windows launcher (logics-parse.bat) and WSL server scripts (CPU / CUDA) |
Get a llama.cpp build with multimodal support (tested with release b11559; CPU or CUDA).
Start the server (bind to localhost):
llama-server -m logics-v3-q8_0.gguf --mmproj mmproj-logics-v3-q8_0.gguf \
-c 32768 -np 1 --image-min-tokens 64 --image-max-tokens 4096 \
--host 127.0.0.1 --port 8080 # add -ngl 99 to use an NVIDIA GPU
Parse a document (Python 3.10+, pip install pillow pymupdf; transformers is only needed for the HF fallback):
python parse_doc.py input.pdf work_dir output.md
Output: output.md (Markdown, tables as HTML), output_images/ (cropped figures),
output_目录.md (heading outline). Re-running the same command resumes an interrupted job.
python convert_hf_to_gguf.py Logics-Parsing-V3 --no-mtp --outtype q8_0 --outfile logics-v3-q8_0.gguf
python convert_hf_to_gguf.py Logics-Parsing-V3 --mmproj --outtype q8_0 --outfile mmproj-logics-v3-q8_0.gguf
--no-mtp is required: the checkpoint sets mtp_num_hidden_layers: null, which makes the
llama.cpp b11559 converter fail otherwise.
Compared with the transformers (fp32) reference output on 5 page types of a 99-page Chinese technical document (dense text, small-font English references, figure page, two complex tables with merged cells), using the upstream long-document prompt:
| Setting | Text similarity to reference | Notes |
|---|---|---|
Q8_0, max_pixels 1600×1600 (default) |
0.98–1.000 (2 of 5 pages identical, 2 at 0.999) | recommended |
Q8_0, max_pixels 1280×1280 |
0.994–1.000 on 4 text/table pages | ~40% faster, but duplicated text inside one dense table cell; figure page segmented differently |
This is a small spot check, not a benchmark. The upstream default is 2048×2048; 1600×1600 was chosen to fit low-memory hardware.
| Backend | Hardware | Time per page |
|---|---|---|
| transformers fp32 | Intel i5-1135G7 (4 cores) | ~255 s |
| llama.cpp Q8_0 CPU | same | ~120–150 s |
| llama.cpp Q8_0 CUDA | NVIDIA GeForce MX350 (2 GB), ~1.7 GB VRAM used | ~36–46 s |
scripts/logics-parse.bat assumes the files live in C:\tools\Logics-Parsing and llama.cpp in
WSL (~/llama, ~/llama-cuda, models in ~/models); edit the paths for your setup.127.0.0.1; it has no authentication.把阿里巴巴 Logics-Parsing-V3 文档解析模型转换为 llama.cpp 可用的 GGUF(Q8_0),并附带一套不依赖
vLLM 的本地解析流程:PDF/图片 → Markdown(表格为 HTML,图片自动裁剪)。适合没有大显存显卡的
Windows/WSL 电脑;在 2GB 显存的 MX350 上,一页密集正文约 40 秒。用法见上方 Quick start,
parse_doc.py 支持断点续跑。
Apache-2.0, same as the original model and code. LICENSE is copied from
alibaba/Logics-Parsing. The GGUF files are format
conversions (with Q8_0 quantization) of the original weights; llamacpp_backend.py,
parse_doc.py, inference_cpu.py and scripts/ are new files added in this repository.