fix(worker): real image 加 tensorflow 支援 tflite #2

Merged
jim800121 merged 1 commits from fix/tflite-tensorflow into main 2026-07-02 07:32:54 +00:00
Collaborator

摘要

real worker image 加裝 tensorflow,修復 tflite 輸入格式轉檔失敗。

背景

staging real worker 轉 tflite 時失敗:ModuleNotFoundError: No module named 'tensorflow'。tflite 走 tflite→(tflite2onnx)→onnx→bie→nef,第一步需要 tensorflow,但先前 build image 時為省大小沒裝(只驗過 onnx/bie/nef 輸入)。

變更(Dockerfile.real)

  • tensorflow-cpu==2.13.1(Python 3.9 + numpy<2 + ktc TF compat patch 交集;-cpu 省 ~1.5GB)
  • igraph==1.0.0(tree_structure.py 硬 import)
  • typing-extensions>=4.8.0(防 TF 降版打爆 fastapi)
  • numpy <2==1.23.5(語意子集、非破鎖)

驗證(本機)

  • image 4.36GB → 5.71GB
  • tflite→onnx 通(產 188 節點合法 ONNX)
  • 既有 BIE→NEF 回歸:產出同一顆真 NEF(621,956 bytes)、prebuild ldd 全 resolved
  • ⚠️ 部署後首要驗證:真實 tflite 走完整 tflite→onnx→bie→nef 各 platform smoke

🤖 Generated with Claude Code

## 摘要 real worker image 加裝 tensorflow,修復 tflite 輸入格式轉檔失敗。 ## 背景 staging real worker 轉 tflite 時失敗:`ModuleNotFoundError: No module named 'tensorflow'`。tflite 走 tflite→(tflite2onnx)→onnx→bie→nef,第一步需要 tensorflow,但先前 build image 時為省大小沒裝(只驗過 onnx/bie/nef 輸入)。 ## 變更(Dockerfile.real) - `tensorflow-cpu==2.13.1`(Python 3.9 + numpy<2 + ktc TF compat patch 交集;-cpu 省 ~1.5GB) - `igraph==1.0.0`(tree_structure.py 硬 import) - `typing-extensions>=4.8.0`(防 TF 降版打爆 fastapi) - numpy `<2` → `==1.23.5`(語意子集、非破鎖) ## 驗證(本機) - image 4.36GB → 5.71GB - tflite→onnx 通(產 188 節點合法 ONNX) - 既有 BIE→NEF 回歸:產出同一顆真 NEF(621,956 bytes)、prebuild ldd 全 resolved - ⚠️ 部署後首要驗證:真實 tflite 走完整 tflite→onnx→bie→nef 各 platform smoke 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jim800121 added 1 commit 2026-07-02 07:32:31 +00:00
staging real worker 轉 tflite 失敗:tflite→onnx 需要 import tensorflow,但
Dockerfile.real 當初為省 image 大小沒裝 TF(只驗過 onnx/bie/nef 輸入)。

改 services/workers/Dockerfile.real:
- 加 tensorflow-cpu==2.13.1(Python 3.9 相容 + numpy<2 相容 + ktc TF compat
  patch 預期範圍的交集;-cpu 省 ~1.5GB CUDA)
- 加 igraph==1.0.0(tree_structure.py 硬 import、pin 對齊本檔版本鎖哲學)
- 補 typing-extensions>=4.8.0(TF 會把它降版打爆 fastapi import)
- numpy<2 精確化為 numpy==1.23.5(落在原 <2 範圍 + TF 接受窗口、語意子集非破鎖)

本機驗證:image 4.36GB→5.71GB;tflite→onnx 通(產 188 節點合法 ONNX);既有
BIE→NEF 回歸產出同一顆真 NEF(621,956 bytes)、prebuild ldd 全 resolved。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jim800121 merged commit 9dfd0e4d77 into main 2026-07-02 07:32:54 +00:00
jim800121 deleted branch fix/tflite-tensorflow 2026-07-02 07:32:54 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: warrenchen/kneron_model_converter#2
No description provided.