前情提要
最近在寫一些小工具,涉及比較敏感的資料,所以不能直接用雲端的 LLM,要用地端/本地的 LLM 處理。過程中遇到一點問題想記錄下來,但是背景有點複雜,建議先閱讀前一篇文章:
預計開發的小工具是這樣的:
- 透過 inotify 偵測特定資料夾(我是用 Python 的套件 watchfiles)。
- 使用 GNOME Document Scanner 將我從 EPSON ES-50 掃描的信用卡簽單 pdf 丟進該資料夾。
- 檔案的變化事件觸發歸檔作業。
- 先用 OCR 抽取簽單資訊。
- 再用 LLM 根據嵌端資訊推論歸檔路徑與檔名。
- 完成歸檔(例如指令路徑:
YYYY/MM/YYYY-MM-DD_{STORENAME}_{AMOUNT}NTD.pdf)並刪除原始檔案。
不過隨著佈署 LLM 和 OCR 的過程中,謎團越來越多,我只好中止開發先來搞清楚究竟是怎麼回事。
無線網路瓶頸
因為我的對外網路是(有限流方案) 4G 無線網路,除了下載速度很感人以外,根據經驗從 Docker Hub 拉取超過 1 GB 的映像檔很高機率會失敗,像這樣:
$ podman pull ghcr.io/ggml-org/llama.cpp:full-vulkan-b9776
Trying to pull ghcr.io/ggml-org/llama.cpp:full-vulkan-b9776...
Getting image source signatures
Copying blob 4f4fb700ef54 skipped: already exists
Copying blob d1f56e4c7f2f skipped: already exists
Copying blob d4a637e5a2c3 [=========>----------------------------] 130.0MiB / 497.0MiB | 458.8 KiB/s
Copying blob 534ac9e261fe done |
Copying blob d2bfdcbbb65a done |
Copying blob a92b05b64059 [===================>------------------] 120.0MiB / 223.3MiB | 105.4 KiB/s
Copying blob 81e2f2053c8f skipped: already exists
Error: copying system image from manifest list: writing blob: storing blob to file "/var/tmp/container_images_storage936046123/2": happened during read: Digest did not match, expected sha256:a92b05b640591907c483d83fccf883b9f5d2b4d90369cd44cca5be58bbf7ea8e, got sha256:38656550ac584269f4bff1c74b238fea1d77c997d8439b484f75d803e7952012