Skip to content

Add ml-tflite component (TensorFlow Lite runtime) - #83

Merged
greyoak111 merged 1 commit into
mainfrom
comp/ml-tflite
Nov 11, 2026
Merged

greyoak111 merged 1 commit into
mainfrom
comp/ml-tflite

Conversation

@greyoak111

@greyoak111 greyoak111 commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

组件 / Component

  • id: ml-tflite
  • 上游 / Upstream: python-tflite-runtime 2.21.0 (Termux main), TensorFlow add.bin test model
  • 许可证 / License: Apache-2.0
  • 主页 / Homepage: https://www.tensorflow.org/lite

What

TensorFlow Lite CPU inference on the device:

  • ml-tflite info — runtime, numpy and bundled model
  • ml-tflite inspect model.tflite — input/output tensor names, shapes and dtypes
  • Python API: tflite_runtime.interpreter.Interpreter

The component is self-contained: numpy is bundled, so it has no component dependencies. The bundled usr/share/ml-tflite/add.bin is TensorFlow's 544-byte Apache-2.0 test model, used only by the offline selftest and examples. User models are supplied separately.

体积与共用包 / Size and sharing

  • 下载 12.2 MB · 装后 38.5 MB · 4 个包(tflite-runtime、numpy、libopenblas + 544 字节测试模型)
  • 与 sci-python、pandas 共用 python-numpy、libopenblas(同一 Termux 版本;有意做成自包含,不 requires sci-python)/ shares python-numpy and libopenblas with sci-python and pandas (same Termux version; self-contained on purpose)

Tested

===== 总结 ===== tflite=2.21.0 numpy=… model=PASS inference=PASS

The selftest loads the bundled model, fills the input tensors with zeros, invokes the interpreter and checks every output. Local audit against devkit-2026.10.28: 0 errors; 🔴 for human review because the component fetches an upstream model from GitHub (sha256 verified at build time). The model's source and Apache-2.0 notice are in usr/share/ml-tflite/NOTICE. The staged package passed locally.

检查 / Checklist

  • node tools/check-recipes.mjs 通过 / passes
  • ci-build.mjs --dry 依赖都能解 / resolves (also built for devkit-2026.10.28)
  • 读过组件编写规则 / read the authoring rules
  • 描述与 skill 里的版本、能力以实际打进包的为准 / description and skill match what is packaged
  • 看过审计报告 / read the audit report (shared packages and risk levels above)
  • 第一次运行要下载的:skill 里写明大小与来源、先问用户 / first-run downloads disclosed and ask first (N/A — the component does not download at runtime; user models are provided by the user)
  • SKILL.md 不会让 Claude 读取或打印令牌、密码 / never reads or prints secrets
  • 对外发布、删除类操作写明先问用户 / asks before public or destructive actions (N/A)
  • needs 如实填写 / filled honestly (shizuku, display, gpu all false)
  • 不涉及反代、共享或转售账户、破甲、批量操控账号 / not for reverse proxies, shared accounts, jailbreaking or mass-controlled accounts

真机测试 / Device test

  • node tools/verify-device.mjs 全过,记录另开 PR 进 verified.json / not run yet; can follow up
  • 设备 / Device:
  • cccodroid 版本 / version:

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

组件审计报告

底座 devkit-2026.10.28(3768afcf79a7)· 规则见 tools/audit.mjs 开头。🟢 看报告即可 · 🟡 要读脚本和 skill · 🔴 要逐行审

🔴 ml-tflite 2.21.0-1-r1

下载 12.2 MB · 装后 38.5 MB · 962 个文件 · 4 个包 (第一次发布)

  • ⚠️ postinst 里会 pip install:python-tflite-runtime —— 装组件时会去 PyPI 现场拉依赖(版本不定、离线装坏、卸载删不掉);把缺的纯 Python 依赖写进配方的 pip
  • ⚠️ 底座与仓库版本不同(组件按底座的版本用): ca-certificates 1:2026.10.20-1→1:2026.11.05-1, libexpat 2.9.0→2.10.0, libsqlite 3.54.1→3.54.1-1, python 3.14.8→3.14.10, python-pip 26.2.2-2→26.3, zlib 1.3.2→1.4
  • ✅ 不会盖掉底座的文件
  • ✅ 21 个 ELF 检查过
  • ✅ 每个 ELF 要的库都找得到
  • ✅ bin 入口与 selftest 命令都在

人要看的:

  • 🟡 SKILL.md 联网下载:L20 如果报 '找不到 numpy',就是组件没装完整——重装组件,不要 'pip install numpy' 另装一份。;L72 - **numpy 缺失**:组件没装完整,重装本组件;不要 'pip install numpy' 另装一份。
  • 🔴 fetch 了仓库外的文件:add.bin ← raw.githubusercontent.com(哈希打包时已核对)
  • 🟡 配方自带文件 2 个:usr/bin/ml-tflite、usr/share/ml-tflite/NOTICE
  • 🟡 装完要跑包的 postinst:python-numpy、python-tflite-runtime

和别的组件共用的包:octave:libopenblas;sci-python:libopenblas, python-numpy

包清单
包 版本 下载
libopenblas 0.3.34 2.5 MB
python-numpy 2.5.4 3.5 MB
python-tflite-runtime 2.21.0-1 1.5 MB
add.bin undefined 0.0 MB

CI 实跑 selftest(arm64 + termux-docker)

组件 结果 说明
ml-tflite ✅ 退出码 0;最后一行:===== 总结 ===== tflite=2.21.0 numpy=2.5.4 model=PASS inference=PASS

环境同 App 里 Claude 的 Bash 工具(PREFIX / HOME / TMPDIR / termux-exec),没有 GPU、屏幕、Shizuku。通过只说明「装得上、跑得起来」,安卓特有的问题仍要真机。

python-tflite-runtime 2.21.0 for CPU inference. It requires sci-python and
excludes numpy, and bundles a 544-byte Apache-2.0 TensorFlow test model for
an offline inference selftest plus an inspect command for user models.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@greyoak111
greyoak111 merged commit a4d7d30 into main Nov 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant