* chore: add CLAUDE.md * chore: pr feedback * chore: contributing guideline rules * chore: pr feedback (cherry picked from commit fc30140e6ec313c94405e7ca4fbab8096dc1c6c7)
1.1 KiB
1.1 KiB
machine-learning/AGENTS.md
Python 3.12 FastAPI service running ONNX models for CLIP, facial recognition and OCR, managed with uv.
Rules
- Install with
uv sync --extra cpu; run tools throughuv runor the mise tasks. mise //machine-learning:checkismypy --strict, and ruff enforces line length 120. Code must pass both.immich_ml/main.pyis the app (/predict,/ping);pipeline.pycomposes the Clip, FacialRecognition and Ocr pipelines.
Skills
- Add or change a model: models live in
immich_ml/models/{clip,facial_recognition,ocr}/and extendInferenceModelinmodels/base.py, which downloads weights with Hugging Facesnapshot_downloadinto the cache folder. Loaded models are kept inmodels/cache.pyModelCache, keyed by class, name and graph, with TTL eviction. Execution backends (ONNX Runtime, RKNN, Arm NN) are inimmich_ml/sessions/. - Run tests: everything is in
test_main.py. One class withuv run pytest test_main.py -k TestCache, one test withtest_main.py::TestCLIP::test_name.mise //machine-learning:test-fulldownloads real models and runs the prediction endpoint tests.