Skip to content

refactor(model): split backend.py into per-backend modules#336

Merged
stanlrt merged 2 commits into
mainfrom
335-split-models-backend-py-into-per-backend-modules
Jun 23, 2026
Merged

refactor(model): split backend.py into per-backend modules#336
stanlrt merged 2 commits into
mainfrom
335-split-models-backend-py-into-per-backend-modules

Conversation

@stanlrt

@stanlrt stanlrt commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Splits src/raitap/models/backend.py into one module per backend, matching the existing tree_backend.py / xgboost_backend.py pattern. Pure structural refactor, zero behaviour change.

  • base_backend.pyModelBackend ABC + shared _adapt_input_shape
  • torch_backend.pyTorchBackend + _is_torchvision_detection_model, _move_tensors_to_device, _torch_hardware_label
  • onnx_backend.pyOnnxBackend + _resolve_onnx_expected_shape, _NUMPY_DTYPES_BY_ONNX_TYPE, _onnx_hardware_label
  • backend.py removed; all ~37 importers repointed (clean break, no shims); dead logger dropped
  • model.py imports the new backend modules at runtime so @register still fires for .onnx/.pth/.pt/.ubj
  • Docs repointed: architecture.md, adding-a-backend.md, models/README.md

Closes #335.

Checklist

  • CI — Required checks are green
  • Breaking changes — Not a breaking change: only internal raitap.models.* import paths move; no public package API, config, or file format changes.
  • Contributor guide — I’ve read Pull requests and commit messages before requesting review.

Optional

  • Issue (optional)Closes Split models/backend.py into per-backend modules #335.
  • Docs (optional)architecture.md, adding-a-backend.md, models/README.md repointed.
  • Tests (optional) — No new tests; pure move, covered verbatim by the existing backend/registration suite.

Comment thread src/raitap/models/base_backend.py
Comment thread src/raitap/models/base_backend.py
Comment thread src/raitap/task_families/detection.py
Comment thread src/raitap/models/registration.py
Comment thread src/raitap/task_families/tests/test_base.py
Comment thread src/raitap/tests/test_run_main.py
@stanlrt stanlrt merged commit 5742a46 into main Jun 23, 2026
18 checks passed
@stanlrt stanlrt deleted the 335-split-models-backend-py-into-per-backend-modules branch June 23, 2026 20:30
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.

Split models/backend.py into per-backend modules

1 participant