-
from_pretrained + **kwargs contract. Every model class is loaded via AutoModel.from_pretrained (models/auto_loaders/core.py) and must implement its own from_pretrained classmethod accepting **kwargs, so negotiation-derived params can be forwarded. New load-time params are threaded as optional kwargs, not positional (e.g. the TorchScript lock in #2373, rf_detr_max_input_resolution in #2145). Canonical: docs/contributors/adding-model.md.
-
Register the model. New arch/task/backend combos land in REGISTERED_MODELS (models/auto_loaders/models_registry.py) keyed by (ModelArchitecture, TaskType, BackendType) → LazyClass(module_name, class_name) or RegistryEntry. Feature-gated backends set RegistryEntry.supported_model_features / required_model_features (e.g. {"nms_fused"}). Auto-loader ranking (models/auto_loaders/ranking.py) puts ONNX above Torch (TRT=7, ONNX=6, TORCH=5) — do not silently reorder it (#2047).
-
Prediction-entity shape stability. Entities live in models/base/*.py — Detections (object_detection.py), InstanceDetections (instance_segmentation.py), KeyPoints (keypoints_detection.py), ClassificationPrediction/MultiLabelClassificationPrediction (classification.py). Each is a torch-tensor dataclass with a to_supervision() consumed by inference/core adapters and Workflows. Do not mutate xyxy/class_id/confidence/mask semantics; add new representations as Union/opt-in (RLE masks added as Union[torch.Tensor, InstancesRLEMasks] + InstanceSegmentationMaskFormat = Literal["dense","rle"], #2260; KeyPoints gained covariance/detection_confidence additively, changelog 0.29.7). Any field change touches every backend + to_supervision() + docs/api-reference/*.
-
Device / dtype discipline. Tensors stay on-device until to_supervision() does .cpu().numpy(). No leaked global autocast — a bf16 torch.autocast that poisoned the whole process was a real bug (#2363, in Sam3TrackerPredictor.__init__, which entered autocast and never exited). Cast processor inputs to the resolved per-device dtype (Jetson bfloat16 fix, changelog 0.29.4).
-
Errors carry help_url to a real docs anchor. errors.py is a tree under BaseInferenceModelsError (help_url optional). New classes get a docs/errors/<page>.md section and are raised with help_url="https://inference-models.roboflow.com/errors/<page>/#<lowercased-classname>" (see configuration.py, which raises InvalidEnvVariable with the runtime-environment anchor). The inference/core handlers (workflows/execution_engine/v1/step_error_handlers.py, interfaces/http/error_handlers.py) map specific classes — ModelNotFoundError, UnauthorizedModelAccessError, ModelPackageRestrictedError, ModelPackageAlternativesExhaustedError — to HTTP/workflow errors; renaming/removing one breaks that mapping (#2180 wired violated-env-constraint reporting through it).
-
Env-var config is validated and documented. New env flags use INFERENCE_MODELS_* naming, are read/validated in configuration.py (raising InvalidEnvVariable on bad values), and are documented in docs/how-to/environment-variables.md + changelog (Triton RF-DETR flags, changelog 0.29.6).
-
Concurrency safety for global-mutating loaders. torch.jit.load/torch.jit.script mutate a process-global, non-thread-safe registry and must be serialized via torchscript_global_lock (models/common/torch.py), threaded from the model manager (#2373; lock=None is a no-op for single-threaded use). Any new global-state loader needs equivalent serialization.
-
ONNX/TRT edge-cases. Batch fast paths respect both min_batch_size and max_batch_size — a fixed-batch model got under-sized batches when only max was checked (#2112). TRT artefacts are inconsistent: output-name verification is skipped for known-bad artefacts (#1790 YOLO-NAS) and engine_host_code_allowed is set where required (#1791 YOLOv10). Watch RF-DETR class remapping / TRT post-processing and cache-path sanitisation (#2075/#1619/#2029).
-
Runtime introspection degrades gracefully. CUDA/Jetson/L4T detection (runtime_introspection/core.py) is best-effort; a failed probe must not crash negotiation (CUDA-version fix #2515; JetsonTypeResolutionError, #1796). New device support must not change platform defaults (#1436 kept MPS non-default on macOS).
-
Third-party API drift is guarded, not pinned in code. transformers/flash-attn drift silently broke OwlV2 / GLM-OCR (#2257/#2266); guard HF-backed models against version drift. supervision-constructor changes belong to the workflows viz block, not here (#2467).
-
Tolerant test assertions. New integration/e2e/GPU assertions use tolerant comparisons (>=, loosened tolerance), not exact box-count/class-set equality, which flakes on GPU/ONNX (#2026, #1646, #1649, #1809, #1638, #1843). Keypoint/segmentation slicing uses model-declared slot counts, not -1 inference (#1626 broke multi-class keypoints with 5 + num_classes / view(..., -1, 3); fix uses fixed 6: offset + _key_points_slots_in_prediction).
Block a functional change unless it carries these contributor-owned companions
(condition → required file):
When the PR also exhibits these cross-cutting concerns, load the matching topic skill too (see each skill's description for the trigger):