Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(signals): serve onnx models in the inbox ranking scoring sweep (#116274)

posthog[bot]d945c980fbd0
diff --git a/products/signals/backend/ranking/model_contract.py b/products/signals/backend/ranking/model_contract.py
index 28520ad380e7..d8fc1530333f 100644
--- a/products/signals/backend/ranking/model_contract.py
+++ b/products/signals/backend/ranking/model_contract.py
@@ -71,7 +71,8 @@ def head_lifts(scores: Mapping[str, float], metadata: Mapping[str, Any]) -> dict
def trained_head_files(metadata: Mapping[str, Any], known_heads: Collection[str]) -> dict[str, str]:
- """The `<head>.ubj` object name per head the candidate fit, of the heads in `known_heads`.
+ """The model file per head the candidate fit, of the heads in `known_heads`: `<head>.ubj` for a
+ per-head booster, and the one shared `model.onnx` for every head of an ONNX model.
Every trained head is scored, readable or not. A rare head never clears `min_holdout_positives`
on one day's holdout, and the pooled newborn grade over many days is the only read that can
diff --git a/products/signals/backend/ranking/model_store.py b/products/signals/backend/ranking/model_store.py
index a4b6212c65db..7e1e7211e895 100644
--- a/products/signals/backend/ranking/model_store.py
+++ b/products/signals/backend/ranking/model_store.py
@@ -38,8 +38,11 @@ from products.signals.backend.ranking.model_contract import (
from products.signals.backend.ranking.overrides import RankingOverrides
from products.signals.backend.ranking.serving_manifest import (
DEFAULT_MODEL_KIND,
+ HEAD_FILE_SUFFIX,
MANIFEST_SERVED_ROLE,
METADATA_FILE,
+ ONNX_MODEL_FILE,
+ ONNX_MODEL_KIND,
SERVED_OVERRIDE_ROLE,
SERVED_ROLE,
ServingManifest,
@@ -49,7 +52,15 @@ from products.signals.backend.ranking.serving_manifest import (
logger = structlog.get_logger(__name__)
-HEAD_FILE_SUFFIX = ".ubj"
+# The ONNX output that holds one probability column per head, in the order of `ONNX_OUTPUT_HEADS_KEY`
+# in the model's `metadata.json`.
+ONNX_OUTPUT = "probabilities"
+ONNX_OUTPUT_HEADS_KEY = "output_heads"
+# The input that takes the feature set's matrix, the report vector.
+ONNX_REPORT_INPUT = "report"
+# Threads one ONNX session may use for one operator. The sweep shares the worker with other
+# activities, so a model must not take every core.
+ONNX_INTRA_OP_THREADS = 2
class ModelLoadError(Exception):
@@ -81,26 +92,33 @@ class ServingSet:
class ModelKindHandler(Protocol):
def load(
- self, entry: ServingManifestEntry, metadata: Mapping[str, Any], head_files: Mapping[str, bytes]
- ) -> LoadedModel: ...
+ self,
+ entry: ServingManifestEntry,
+ metadata: Mapping[str, Any],
+ feature_set: FeatureSet,
+ files: Mapping[str, bytes],
+ ) -> LoadedModel:
+ """`feature_set` is the set `metadata` declares, and `files` holds the body of each name in `entry.files`."""
+ ...
class XGBoostHandler:
"""One binary XGBoost booster per head, all fit on the same feature set."""
def load(
- self, entry: ServingManifestEntry, metadata: Mapping[str, Any], head_files: Mapping[str, bytes]
+ self,
+ entry: ServingManifestEntry,
+ metadata: Mapping[str, Any],
+ feature_set: FeatureSet,
+ files: Mapping[str, bytes],
) -> LoadedModel:
import xgboost as xgb # noqa: PLC0415 — keeps xgboost's native OpenMP runtime off the Temporal worker import path
- feature_set = model_feature_set(metadata)
- if feature_set is None:
- raise ModelLoadError(f"{entry.key} declares a feature set this build cannot produce")
boosters: dict[str, xgb.Booster] = {}
- for head, raw in head_files.items():
+ for head in entry.heads:
booster = xgb.Booster()
try:
- booster.load_model(bytearray(raw))
+ booster.load_model(bytearray(files[f"{head}{HEAD_FILE_SUFFIX}"]))
except xgb.core.XGBoostError as error:
raise ModelLoadError(f"{entry.key} {head} booster does not load: {error}") from error
mismatch = booster_mismatch(head, booster.feature_names, feature_set)
@@ -116,8 +134,87 @@ class XGBoostHandler:
return LoadedModel(entry=entry, feature_set=feature_set, metadata=metadata, predict=predict)
-# The place a new learner plugs in, e.g. a torch model with its own `predict`.
-MODEL_KIND_HANDLERS: Mapping[str, ModelKindHandler] = {DEFAULT_MODEL_KIND: XGBoostHandler()}
+class ONNXHandler:
+ """One ONNX graph that scores every head, from the inputs the feature set builds."""
+
+ def load(
+ self,
+ entry: ServingManifestEntry,
+ metadata: Mapping[str, Any],
+ feature_set: FeatureSet,
+ files: Mapping[str, bytes],
+ ) -> LoadedModel:
+ import onnxruntime as ort # noqa: PLC0415 — keeps onnxruntime's native runtime off the Temporal worker import path
+
+ options = ort.SessionOptions()
+ options.intra_op_num_threads = ONNX_INTRA_OP_THREADS
+ options.inter_op_num_threads = 1
+ try:
+ session = ort.InferenceSession(
+ files[ONNX_MODEL_FILE], sess_options=options, providers=["CPUExecutionProvider"]
+ )
+ # onnxruntime's errors share no base class below Exception.
+ except Exception as error:
+ raise ModelLoadError(f"{entry.key} {ONNX_MODEL_FILE} does not load: {error}") from error
+ mismatch = _onnx_input_mismatch(session.get_inputs(), _onnx_input_widths(feature_set))
+ if mismatch is not None:
+ raise ModelLoadError(f"{entry.key} {mismatch}")
+ output_heads = list(metadata.get(ONNX_OUTPUT_HEADS_KEY) or ())
+ mismatch = _onnx_output_mismatch(session.get_outputs(), output_heads, entry.heads)
+ if mismatch is not None:
+ raise ModelLoadError(f"{entry.key} {mismatch}")
+ columns = {head: output_heads.index(head) for head in entry.heads}
+
+ def predict(matrix: np.ndarray) -> dict[str, np.ndarray]:
+ (probabilities,) = session.run(
+ [ONNX_OUTPUT], {ONNX_REPORT_INPUT: np.ascontiguousarray(matrix, dtype=np.float32)}
+ )
+ return {head: probabilities[:, column] for head, column in columns.items()}
+
+ return LoadedModel(entry=entry, feature_set=feature_set, metadata=metadata, predict=predict)
+
+
+def _onnx_input_widths(feature_set: FeatureSet) -> dict[str, int]:
+ """The width of each ONNX input the scorer can feed for `feature_set`.
+
+ Only the report vector today. The project-vector inputs join here when the sweep can read
+ project vectors, and `predict` then feeds them too.
+ """
+ return {ONNX_REPORT_INPUT: len(feature_set.feature_names)}
+
+
+def _onnx_input_mismatch(inputs: Sequence[Any], widths: Mapping[str, int]) -> str | None:
+ """Why the graph's inputs differ from what the scorer feeds, or None when they agree.
+
+ Each input must be float32 with shape `(batch, width)`.
+ """
+ names = sorted(node.name for node in inputs)
+ if names != sorted(widths):
+ return f"{ONNX_MODEL_FILE} inputs {names} are not {sorted(widths)}"
+ for node in inputs:
+ if node.type != "tensor(float)" or len(node.shape) != 2 or node.shape[1] != widths[node.name]:
+ return f"{ONNX_MODEL_FILE} input {node.name} is {node.type} {node.shape}, not float (batch, {widths[node.name]})"
+ return None
+
+
+def _onnx_output_mismatch(outputs: Sequence[Any], output_heads: Sequence[str], heads: Sequence[str]) -> str | None:
+ """Why the graph's output cannot give a probability for each of `heads`, or None when it can."""
+ output = next((node for node in outputs if node.name == ONNX_OUTPUT), None)
+ if output is None:
+ return f"{ONNX_MODEL_FILE} has no {ONNX_OUTPUT} output"
+ if len(output.shape) != 2 or output.shape[1] != len(output_heads):
+ return f"{ONNX_MODEL_FILE} {ONNX_OUTPUT} is {output.shape}, not (batch, {len(output_heads)}) for {ONNX_OUTPUT_HEADS_KEY}"
+ missing = sorted(set(heads) - set(output_heads))
+ if missing:
+ return f"{METADATA_FILE} {ONNX_OUTPUT_HEADS_KEY} has no column for {missing}"
+ return None
+
+
+# The place a new learner plugs in, with its own `predict`.
+MODEL_KIND_HANDLERS: Mapping[str, ModelKindHandler] = {
+ DEFAULT_MODEL_KIND: XGBoostHandler(),
+ ONNX_MODEL_KIND: ONNXHandler(),
+}
_cache: OrderedDict[str, LoadedModel] = OrderedDict()
_cache_lock = threading.Lock()
@@ -133,19 +230,20 @@ def _read_entry(entry: ServingManifestEntry) -> LoadedModel:
metadata = json.loads(raw_metadata)
if (metadata.get("model_name"), metadata.get("model_version")) != (entry.model_name, entry.model_version):
raise ModelLoadError(f"{entry.key} {METADATA_FILE} describes another model")
+ feature_set = model_feature_set(metadata)
mismatch = model_mismatch(metadata)
- if mismatch is not None:
+ if feature_set is None or mismatch is not None:
raise ModelLoadError(f"{entry.key} {mismatch}")
untrained = sorted(set(entry.heads) - set(trained_head_files(metadata, entry.heads)))
if untrained:
- raise ModelLoadError(f"{entry.key} {METADATA_FILE} has no trained booster for {untrained}")
- head_files: dict[str, bytes] = {}
- for head in entry.heads:
- body = object_storage.read_bytes(f"{entry.prefix}/{head}{HEAD_FILE_SUFFIX}", missing_ok=True)
+ raise ModelLoadError(f"{entry.key} {METADATA_FILE} has no trained model file for {untrained}")
+ files: dict[str, bytes] = {}
+ for name in entry.files:
+ body = object_storage.read_bytes(f"{entry.prefix}/{name}", missing_ok=True)
if body is None:
- raise ModelLoadError(f"{entry.key} has no {head}{HEAD_FILE_SUFFIX} under {entry.prefix}")
- head_files[head] = body
- return handler.load(entry, metadata, head_files)
+ raise ModelLoadError(f"{entry.key} has no {name} under {entry.prefix}")
+ files[name] = body
+ return handler.load(entry, metadata, feature_set, files)
def load_model(entry: ServingManifestEntry) -> LoadedModel:
diff --git a/products/signals/backend/ranking/serving_manifest.py b/products/signals/backend/ranking/serving_manifest.py
index d15f6b9f7c03..9c2f1d3915b5 100644
--- a/products/signals/backend/ranking/serving_manifest.py
+++ b/products/signals/backend/ranking/serving_manifest.py
@@ -35,9 +35,14 @@ PINNED_ROLE = "pinned"
SERVED_OVERRIDE_ROLE = "served_override"
MANIFEST_SERVED_ROLE = "manifest_served"
-# The learner a model store loads the booster with. Every family is per-head XGBoost today, and a
-# model published before the field existed is one of those, so this is also the read fallback.
+# The learner a model store loads the model with. A model published before the field existed is
+# per-head XGBoost, so this is also the read fallback.
DEFAULT_MODEL_KIND = "xgboost"
+# One ONNX graph that scores every head, in `ONNX_MODEL_FILE`, rather than one booster per head.
+ONNX_MODEL_KIND = "onnx"
+ONNX_MODEL_FILE = "model.onnx"
+# The suffix of a per-head booster file, `<head>.ubj`.
+HEAD_FILE_SUFFIX = ".ubj"
MANIFEST_FILE = "manifest.json"
METADATA_FILE = "metadata.json"
@@ -50,7 +55,7 @@ def serving_manifest_key(prefix: str) -> str:
def serving_model_prefix(prefix: str, key: str) -> str:
- """Where one model's `metadata.json` and head boosters sit. Keyed by `<name>@<version>`, so a
+ """Where one model's `metadata.json` and model files sit. Keyed by `<name>@<version>`, so a
version is published once however many manifests name it."""
return f"{prefix}/{_SERVING_SEGMENT}/models/{key}"
@@ -69,14 +74,21 @@ class ServingManifestEntry(BaseModel):
key: str = Field(description="`<model_name>@<model_version>`, the identity every consumer uses.")
model_name: str = Field(description="Feature family the model belongs to, e.g. `report_embeddings`.")
model_version: str = Field(description="Training partition the model was fit on, as `YYYY-MM-DD`.")
- model_kind: str = Field(description="Learner the model store loads the booster with, e.g. `xgboost`.")
+ model_kind: str = Field(description="Learner the model store loads the model with, `xgboost` or `onnx`.")
roles: list[str] = Field(
min_length=1,
description=f"Why this model is in the manifest. Exactly one entry carries `{SERVED_ROLE}`.",
)
labels: dict[str, str] = Field(default_factory=dict, description="Free text about the entry, for a reader.")
- prefix: str = Field(description="Object-store prefix holding this model's `metadata.json` and head boosters.")
- heads: list[str] = Field(min_length=1, description="Outcome heads with a booster under `prefix`.")
+ prefix: str = Field(description="Object-store prefix holding this model's `metadata.json` and model files.")
+ heads: list[str] = Field(min_length=1, description="Outcome heads the model scores.")
+ model_file: str | None = Field(
+ default=None,
+ description=(
+ f"The one file under `prefix` that scores every head, e.g. `{ONNX_MODEL_FILE}`. "
+ f"Null when each head has its own `<head>{HEAD_FILE_SUFFIX}` booster."
+ ),
+ )
@field_validator("key", "model_name", "model_version", "model_kind", "prefix")
@classmethod
@@ -92,6 +104,19 @@ class ServingManifestEntry(BaseModel):
raise ValueError(f"key {self.key!r} does not match its model {expected!r}")
return self
+ @model_validator(mode="after")
+ def onnx_names_its_model_file(self) -> ServingManifestEntry:
+ if self.model_kind == ONNX_MODEL_KIND and self.model_file != ONNX_MODEL_FILE:
+ raise ValueError(f"an {ONNX_MODEL_KIND} entry must name {ONNX_MODEL_FILE}, got {self.model_file!r}")
+ return self
+
+ @property
+ def files(self) -> list[str]:
+ """The model files under `prefix`, without `metadata.json`."""
+ if self.model_file is not None:
+ return [self.model_file]
+ return [f"{head}{HEAD_FILE_SUFFIX}" for head in self.heads]
+
class ServingManifest(BaseModel):
"""The models one scoring pass runs. A pass writes one `ranking_score` row naming all of them."""
diff --git a/products/signals/backend/test/fixtures/onnx/build_onnx_fixtures.py b/products/signals/backend/test/fixtures/onnx/build_onnx_fixtures.py
new file mode 100644
index 000000000000..294169b45140
--- /dev/null
+++ b/products/signals/backend/test/fixtures/onnx/build_onnx_fixtures.py
@@ -0,0 +1,62 @@
+"""Writes the ONNX fixtures the ranking scoring tests load, so the tests need neither torch nor network.
+
+Run from the repository root:
+
+ uv run --with onnx==1.21.0 python products/signals/backend/test/fixtures/onnx/build_onnx_fixtures.py
+
+Each graph is `sigmoid(report @ weights + bias)`, the shape the inbox ranking network exports:
+an input `report` of shape (batch, width) and an output `probabilities` of shape (batch, heads).
+The weights are seeded, so a rerun writes the same files.
+"""
+
+from pathlib import Path
+
+import onnx
+import numpy as np
+from onnx import TensorProto, helper, numpy_helper
+
+FIXTURES = Path(__file__).parent
+# Opset 17 is the oldest one every onnxruntime the repo pins can read.
+OPSET = 17
+HEADS = 2
+SERVED_WIDTH = 1536
+EXPECTED_ROWS = 3
+
+
+def _graph(input_name: str, width: int, seed: int) -> tuple[onnx.ModelProto, np.ndarray, np.ndarray]:
+ rng = np.random.default_rng(seed)
+ weights = (rng.normal(size=(width, HEADS)) * 0.05).astype(np.float32)
+ bias = rng.normal(size=HEADS).astype(np.float32)
+ graph = helper.make_graph(
+ nodes=[
+ helper.make_node("MatMul", [input_name, "weights"], ["logits_no_bias"]),
+ helper.make_node("Add", ["logits_no_bias", "bias"], ["logits"]),
+ helper.make_node("Sigmoid", ["logits"], ["probabilities"]),
+ ],
+ name="inbox_ranking_fixture",
+ inputs=[helper.make_tensor_value_info(input_name, TensorProto.FLOAT, ["batch", width])],
+ outputs=[helper.make_tensor_value_info("probabilities", TensorProto.FLOAT, ["batch", HEADS])],
+ initializer=[numpy_helper.from_array(weights, "weights"), numpy_helper.from_array(bias, "bias")],
+ )
+ model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", OPSET)], producer_name="posthog-fixture")
+ model.ir_version = 8
+ onnx.checker.check_model(model)
+ return model, weights, bias
+
+
+def main() -> None:
+ served, weights, bias = _graph("report", SERVED_WIDTH, seed=0)
+ onnx.save(served, FIXTURES / "report.onnx")
+ report = np.random.default_rng(1).normal(size=(EXPECTED_ROWS, SERVED_WIDTH)).astype(np.float32)
+ logits = report.astype(np.float64) @ weights.astype(np.float64) + bias.astype(np.float64)
+ probabilities = (1.0 / (1.0 + np.exp(-logits))).astype(np.float32)
+ np.savez(FIXTURES / "report.expected.npz", report=report, probabilities=probabilities)
+
+ narrow, _, _ = _graph("report", 8, seed=2)
+ onnx.save(narrow, FIXTURES / "narrow_report.onnx")
+ renamed, _, _ = _graph("vector", 8, seed=3)
+ onnx.save(renamed, FIXTURES / "unknown_input.onnx")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/products/signals/backend/test/fixtures/onnx/narrow_report.onnx b/products/signals/backend/test/fixtures/onnx/narrow_report.onnx
new file mode 100644
index 000000000000..9b8927d98d69
Binary files /dev/null and b/products/signals/backend/test/fixtures/onnx/narrow_report.onnx differ
diff --git a/products/signals/backend/test/fixtures/onnx/report.expected.npz b/products/signals/backend/test/fixtures/onnx/report.expected.npz
new file mode 100644
index 000000000000..f3e560cadbf4
Binary files /dev/null and b/products/signals/backend/test/fixtures/onnx/report.expected.npz differ
diff --git a/products/signals/backend/test/fixtures/onnx/report.onnx b/products/signals/backend/test/fixtures/onnx/report.onnx
new file mode 100644
index 000000000000..c64352b30d08
Binary files /dev/null and b/products/signals/backend/test/fixtures/onnx/report.onnx differ
diff --git a/products/signals/backend/test/fixtures/onnx/unknown_input.onnx b/products/signals/backend/test/fixtures/onnx/unknown_input.onnx
new file mode 100644
index 000000000000..541c6bf03823
Binary files /dev/null and b/products/signals/backend/test/fixtures/onnx/unknown_input.onnx differ
diff --git a/products/signals/backend/test/test_ranking_scoring.py b/products/signals/backend/test/test_ranking_scoring.py
index 238bec2499b6..71d1f18a7627 100644
--- a/products/signals/backend/test/test_ranking_scoring.py
+++ b/products/signals/backend/test/test_ranking_scoring.py
@@ -1,12 +1,17 @@
+import sys
import json
import datetime
+import subprocess
from collections.abc import Iterator, Mapping, Sequence
from contextlib import contextmanager
+from pathlib import Path
from typing import Any, cast
+import pytest
from posthog.test.base import BaseTest, ClickhouseTestMixin
from unittest.mock import patch
+from django.conf import settings
from django.test import SimpleTestCase, override_settings
import numpy as np
@@ -34,6 +39,8 @@ from products.signals.backend.ranking.serving_manifest import (
DAILY_CANDIDATE_ROLE,
MANIFEST_SERVED_ROLE,
METADATA_FILE,
+ ONNX_MODEL_FILE,
+ ONNX_MODEL_KIND,
PINNED_ROLE,
SERVED_OVERRIDE_ROLE,
SERVED_ROLE,
@@ -57,6 +64,10 @@ OLDER_VERSION = "2026-08-25"
NOW = datetime.datetime(2026, 9, 2, 12, 0, tzinfo=datetime.UTC)
LANDED = datetime.datetime(2026, 9, 2, 9, 0, tzinfo=datetime.UTC)
HEADS = ("open", "thumbs_up")
+ONNX_FIXTURES = Path(__file__).parent / "fixtures" / "onnx"
+# The column order of the fixture's `probabilities` output. Reversed from HEADS, so a model that
+# reads columns in manifest order gives each head the other head's probability.
+ONNX_OUTPUT_HEADS = ("thumbs_up", "open")
_BOOSTERS: dict[tuple[str, ...], bytes] = {}
@@ -100,10 +111,12 @@ class FakeObjectStore:
booster_feature_names: tuple[str, ...] | None = None,
missing_heads: Sequence[str] = (),
thresholds: Mapping[str, float] | None = None,
+ onnx_fixture: str = "report.onnx",
) -> ServingManifestEntry:
key = model_key(model_name, version)
prefix = serving_model_prefix(PREFIX, key)
- metadata = {
+ onnx = model_kind == ONNX_MODEL_KIND
+ metadata: dict[str, Any] = {
"model_name": model_name,
"model_version": version,
"model_kind": model_kind,
@@ -113,7 +126,7 @@ class FakeObjectStore:
"heads": [
{
"head": head,
- "file": f"{head}.ubj",
+ "file": ONNX_MODEL_FILE if onnx else f"{head}.ubj",
"readable": head == "open",
**(
{"refit_classification_threshold": thresholds[head]}
@@ -124,11 +137,15 @@ class FakeObjectStore:
for head in HEADS
],
}
+ if onnx:
+ metadata["output_heads"] = list(ONNX_OUTPUT_HEADS)
+ self.objects[f"{prefix}/{ONNX_MODEL_FILE}"] = (ONNX_FIXTURES / onnx_fixture).read_bytes()
+ else:
+ booster = _booster_ubj(booster_feature_names or feature_set.feature_names)
+ for head in HEADS:
+ if head not in missing_heads:
+ self.objects[f"{prefix}/{head}.ubj"] = booster
self.objects[f"{prefix}/{METADATA_FILE}"] = json.dumps(metadata).encode()
- booster = _booster_ubj(booster_feature_names or feature_set.feature_names)
- for head in HEADS:
- if head not in missing_heads:
- self.objects[f"{prefix}/{head}.ubj"] = booster
return ServingManifestEntry(
key=key,
model_name=model_name,
@@ -137,6 +154,7 @@ class FakeObjectStore:
roles=list(roles),
prefix=prefix,
heads=list(HEADS),
+ model_file=ONNX_MODEL_FILE if onnx else None,
)
def publish_manifest(self, entries: Sequence[ServingManifestEntry]) -> ServingManifest:
@@ -187,6 +205,16 @@ class TestModelStore(_StoreTestMixin, SimpleTestCase):
("booster_on_other_features", {"booster_feature_names": ("age_hours",)}, "booster"),
("missing_head_file", {"missing_heads": ["thumbs_up"]}, "thumbs_up.ubj"),
("unknown_model_kind", {"model_kind": "torch"}, "torch"),
+ (
+ "onnx_input_width",
+ {"model_kind": ONNX_MODEL_KIND, "onnx_fixture": "narrow_report.onnx"},
+ "input report is tensor(float) ['batch', 8], not float (batch, 1536)",
+ ),
+ (
+ "onnx_input_name",
+ {"model_kind": ONNX_MODEL_KIND, "onnx_fixture": "unknown_input.onnx"},
+ "inputs ['vector'] are not ['report']",
+ ),
]
)
def test_a_challenger_that_cannot_load_is_skipped(self, _name: str, kwargs: dict, reason: str) -> None:
@@ -361,6 +389,47 @@ class TestScorer(_ScorerTestMixin, SimpleTestCase):
assert outcome.score.embedding_inserted_at == LANDED
assert captured.events == []
+ def test_xgboost_and_onnx_models_score_in_one_pass(self) -> None:
+ served = self._served()
+ onnx = self._challenger("title_embeddings", TITLE_EMBEDDINGS_FEATURE_SET, model_kind=ONNX_MODEL_KIND)
+ self.store.publish_manifest([served, onnx])
+ expected = np.load(ONNX_FIXTURES / "report.expected.npz")
+ report_ids = [f"r{index}" for index in range(len(expected["report"]))]
+ vectors = {
+ rendering: {
+ report_id: ReportVector(embedding=vector, inserted_at=LANDED)
+ for report_id, vector in zip(report_ids, expected["report"])
+ }
+ for rendering in (EMBEDDING_RENDERING_TITLE_SUMMARY, EMBEDDING_RENDERING_TITLE)
+ }
+
+ outcomes, _, _ = self._score(report_ids, vectors, persist=False)
+
+ for outcome, probabilities in zip(outcomes, expected["probabilities"]):
+ assert outcome.score is not None
+ results = outcome.score.results
+ assert (results[served.key].status, set(results[served.key].scores)) == ("scored", set(HEADS))
+ assert results[onnx.key].status == "scored"
+ expected_scores = dict(zip(ONNX_OUTPUT_HEADS, probabilities.tolist()))
+ assert results[onnx.key].scores == pytest.approx(expected_scores, abs=1e-6)
+
+
+def test_importing_the_scoring_sweep_loads_no_model_runtime() -> None:
+ result = subprocess.run(
+ [
+ sys.executable,
+ "-c",
+ "import sys, django; django.setup(); import products.signals.backend.ranking.sweep; "
+ "print(sorted({'onnxruntime', 'xgboost'} & set(sys.modules)))",
+ ],
+ cwd=settings.BASE_DIR,
+ capture_output=True,
+ text=True,
+ timeout=60,
+ )
+ assert result.returncode == 0, result.stderr
+ assert result.stdout.strip().splitlines()[-1] == "[]"
+
class TestClassificationProperties(SimpleTestCase):
@parameterized.expand(
diff --git a/products/signals/dags/inbox_ranking/AGENTS.md b/products/signals/dags/inbox_ranking/AGENTS.md
index 5ecef58d717a..2c969929eb7e 100644
--- a/products/signals/dags/inbox_ranking/AGENTS.md
+++ b/products/signals/dags/inbox_ranking/AGENTS.md
@@ -30,7 +30,8 @@ Read `README.md` first for what the dataset is and how partitions behave. This f
- Skipping is not the same as rebuilding from nothing, and the difference is destructive. An empty examples object produces an empty candidate, and the candidate's prefix cleanup then deletes the boosters that partition already holds, which a `champion.json` can be pointing at. So when a side input is unavailable, leave the partition's objects alone rather than writing empty ones over them.
- The champion is compared to a candidate on the candidate's holdout, through the champion's `<head>.holdout.ubj` (the train-only fit). Keep writing that file: without it the gate falls back to the champion's stored AUC, which was measured on a different set of reports.
- The example builder reads labels aligned to the state spine (`assemble_snapshot`): no label row means all-zero labels, not "absent". It drops rows whose `features_observed_at` is a backfill (`STATE_LAG_LIMIT`) and, for status-derived heads, rows that fail `label_provenance_ok`.
-- The serving path reads the deployment's own object store, never the dataset bucket: the Temporal workers have no credential for that bucket, and keeping it that way is why the manifest asset copies what the sweep needs. `serving/models/<key>/` holds a version's `metadata.json` and its refit boosters, `serving/manifest.json` names the models one pass scores. The holdout boosters grade a promotion and must stay behind.
+- The serving path reads the deployment's own object store, never the dataset bucket: the Temporal workers have no credential for that bucket, and keeping it that way is why the manifest asset copies what the sweep needs. `serving/models/<key>/` holds a version's `metadata.json` and its model files, `serving/manifest.json` names the models one pass scores. The holdout boosters grade a promotion and must stay behind.
+- An entry's files come from `ServingManifestEntry.files`: one `<head>.ubj` per head for `xgboost`, and the one `model.onnx` that `model_file` names for `onnx`. The copy step and the model store read that property, and the pin check reads the same names from each head's `file` in `metadata.json`, so a new model kind with another file layout keeps the two in step. Keep `onnxruntime` and `xgboost` imports inside the handlers' `load`: a test pins that importing the sweep loads neither.
- The manifest schema and the object keys live in `products/signals/backend/ranking/serving_manifest.py`, next to the feature contract, because the dag writes them and the sweep reads them. Its validators run at write time, so the dag refuses a manifest the sweep could not act on; the entry cap is the `ranking_score` artefact's, so a manifest can never produce a row the artefact refuses.
- Publishing order is load-bearing. Every model copy finishes before `manifest.json` is written, so a failed copy leaves the previous manifest and the previous models serving. A model version is immutable, so a version whose `metadata.json` is already at the target is not copied again. A run with nothing to publish, and no champion for the served family is the case today, writes nothing rather than an empty manifest.
diff --git a/products/signals/dags/inbox_ranking/README.md b/products/signals/dags/inbox_ranking/README.md
index 6bc7b31d1a3e..d80d0de85dd4 100644
--- a/products/signals/dags/inbox_ranking/README.md
+++ b/products/signals/dags/inbox_ranking/README.md
@@ -165,10 +165,16 @@ s3://<bucket>/<prefix>/
```text
s3://<object-storage bucket>/<prefix>/serving/
-├── models/<model_name>@<model_version>/metadata.json + <head>.ubj # the refit boosters only
+├── models/<model_name>@<model_version>/metadata.json + <head>.ubj # xgboost: the refit boosters only
+├── models/<model_name>@<model_version>/metadata.json + model.onnx # onnx: one graph for every head
└── manifest.json # the models one scoring pass runs
```
+Each entry names its `model_kind`, and the sweep loads it through that kind's handler in `products/signals/backend/ranking/model_store.py`:
+
+- `xgboost`, the default for a model without the field: one booster per head, `<head>.ubj`. The entry's `heads` list names the files.
+- `onnx`: one `model.onnx` for every head. The entry names it in `model_file`, and `heads` still lists the heads it scores. The graph takes one float32 input, `report`, of shape (batch, feature-set width), and gives one output, `probabilities`, of shape (batch, heads). The column order of that output is `output_heads` in the model's `metadata.json`, and each head entry in `heads` there names `model.onnx` as its `file`. At load, the handler checks the input names and widths against what the model's feature set builds, and a mismatch skips the model like an unloadable booster. The session runs on CPU with a bounded thread count, and `onnxruntime` is imported only when a model loads. The project-vector inputs are not served yet.
+
The manifest holds one entry per model with its `roles`: `served` for the champion of `INBOX_RANKING_SERVED_FAMILY`, `daily_candidate` for that family's candidate on this partition when it is a different, readable model, `pinned` for each model the `pin` override keeps (see [Overrides](#overrides)), and `cross_family` for every other family's champion that has a readable head. A pass scores all of them, so an online paired read and a later interleaving need no rescoring; the entry count is capped at the `ranking_score` artefact's own limit, dropping `cross_family` entries first and `pinned` entries next. The schema, the role names and the object keys live in `products/signals/backend/ranking/serving_manifest.py`, and its validators run at write time, so the dag refuses a manifest the sweep could not act on. A model version is immutable, so a version already in the store is not copied again, and `manifest.json` is written last: a failed copy leaves the previous manifest and the previous models serving. No family has a champion until the first promotion, so until then the asset writes nothing and says why.
A region that does not train serves the same models through a mirror. When `INBOX_RANKING_SERVING_MIRROR_BUCKET` is set, the asset repeats the publish into that bucket after the primary publish succeeds, in the same order and with the same skip of versions already there. A mirror failure does not fail the asset: it logs, and the `inbox_ranking_serving_manifest_published` event carries `mirror_published=false`. The property is absent when no mirror is set.
diff --git a/products/signals/dags/inbox_ranking/tests/test_training.py b/products/signals/dags/inbox_ranking/tests/test_training.py
index 8f8fe1ac825a..866803744d63 100644
--- a/products/signals/dags/inbox_ranking/tests/test_training.py
+++ b/products/signals/dags/inbox_ranking/tests/test_training.py
@@ -42,6 +42,8 @@ from products.signals.backend.ranking.serving_manifest import (
CROSS_FAMILY_ROLE,
DAILY_CANDIDATE_ROLE,
DEFAULT_MODEL_KIND,
+ ONNX_MODEL_FILE,
+ ONNX_MODEL_KIND,
PINNED_ROLE,
SERVED_ROLE,
ServingManifest,
@@ -2535,11 +2537,13 @@ def test_a_family_without_examples_keeps_the_partition_it_already_has():
assert metadata[f"{EMBEDDINGS_MODEL_NAME}_skipped"].value is True
-def _serving_metadata(model_name: str, version: str, *, heads=("open", "action"), readable=True, **overrides):
+def _serving_metadata(
+ model_name: str, version: str, *, heads=("open", "action"), readable=True, model_file=None, **overrides
+):
return {
"model_name": model_name,
"model_version": version,
- "heads": [{"head": head, "readable": readable, "file": f"{head}.ubj"} for head in heads],
+ "heads": [{"head": head, "readable": readable, "file": model_file or f"{head}.ubj"} for head in heads],
**overrides,
}
@@ -2595,18 +2599,29 @@ def test_a_manifest_the_sweep_could_not_act_on_is_refused(models, message):
ServingManifest(manifest_version="2026-08-19T06:00:00+00:00", models=models)
-def test_a_manifest_entry_key_must_match_its_model():
- # The key is the join between a manifest entry, a stored score and a model prefix. A key that
- # names a different version sends the sweep to the wrong prefix and stores the wrong identity.
- with pytest.raises(ValidationError, match="does not match its model"):
+ "overrides,message",
+ [
+ # The key is the join between a manifest entry, a stored score and a model prefix. A key that
+ # names a different version sends the sweep to the wrong prefix and stores the wrong identity.
+ ({"key": "state_xgb@2026-08-18"}, "does not match its model"),
+ # Without the file name the copy step and the store look for per-head boosters that do not exist.
+ ({"model_kind": ONNX_MODEL_KIND}, f"must name {ONNX_MODEL_FILE}"),
+ ],
+)
+def test_a_manifest_entry_the_sweep_could_not_load_is_refused(overrides, message):
+ with pytest.raises(ValidationError, match=message):
ServingManifestEntry(
- key="state_xgb@2026-08-18",
- model_name=STATE_MODEL_NAME,
- model_version="2026-08-19",
- model_kind=DEFAULT_MODEL_KIND,
- roles=[SERVED_ROLE],
- prefix="inbox_ranking/serving/models/state_xgb@2026-08-19",
- heads=["open"],
+ **{
+ "key": "state_xgb@2026-08-19",
+ "model_name": STATE_MODEL_NAME,
+ "model_version": "2026-08-19",
+ "model_kind": DEFAULT_MODEL_KIND,
+ "roles": [SERVED_ROLE],
+ "prefix": "inbox_ranking/serving/models/state_xgb@2026-08-19",
+ "heads": ["open"],
+ **overrides,
+ }
)
@@ -2783,19 +2798,21 @@ class _AppObjectStore:
self.written.append(key)
-def _serving_dataset_s3(prefix: str, partition_key: str):
+def _serving_dataset_s3(prefix: str, partition_key: str, model_kind: str = DEFAULT_MODEL_KIND):
"""The dataset bucket holding one champion and one candidate of the served family."""
+ onnx = model_kind == ONNX_MODEL_KIND
+ model_file = ONNX_MODEL_FILE if onnx else "open.ubj"
+
+ def metadata(version: str) -> dict[str, Any]:
+ kind = {"model_kind": model_kind, "model_file": ONNX_MODEL_FILE} if onnx else {}
+ return _serving_metadata(EMBEDDINGS_MODEL_NAME, version, heads=("open",), **kind)
+
objects: dict[str, bytes] = {}
- for version, metadata in (
- ("2026-08-15", _serving_metadata(EMBEDDINGS_MODEL_NAME, "2026-08-15", heads=("open",))),
- (partition_key, _serving_metadata(EMBEDDINGS_MODEL_NAME, partition_key, heads=("open",))),
- ):
+ for version in ("2026-08-15", partition_key):
folder = model_object_key(prefix, EMBEDDINGS_MODEL_NAME, version, "")
- objects[folder + METADATA_FILE] = json.dumps(metadata).encode()
- objects[folder + "open.ubj"] = f"booster-{version}".encode()
- objects[champion_object_key(prefix, EMBEDDINGS_MODEL_NAME)] = json.dumps(
- _serving_metadata(EMBEDDINGS_MODEL_NAME, "2026-08-15", heads=("open",))
- ).encode()
+ objects[folder + METADATA_FILE] = json.dumps(metadata(version)).encode()
+ objects[folder + model_file] = f"booster-{version}".encode()
+ objects[champion_object_key(prefix, EMBEDDINGS_MODEL_NAME)] = json.dumps(metadata("2026-08-15")).encode()
return _ModelStoreS3(objects)
@@ -2835,22 +2852,31 @@ def _manifest_event(capture: _FakeClient) -> dict[str, Any]:
return event
[email protected]("mirrored", [False, True])
+ "mirrored,model_kind,model_file",
+ [
+ (False, DEFAULT_MODEL_KIND, "open.ubj"),
+ (True, DEFAULT_MODEL_KIND, "open.ubj"),
+ (False, ONNX_MODEL_KIND, ONNX_MODEL_FILE),
+ ],
+)
def test_publishing_copies_every_model_the_manifest_names_and_writes_the_manifest_last(
- monkeypatch: pytest.MonkeyPatch, mirrored: bool
+ monkeypatch: pytest.MonkeyPatch, mirrored: bool, model_kind: str, model_file: str
) -> None:
# The EU sweep reads the mirror, so it needs the same files, in the same order, as the primary.
prefix = settings.INBOX_RANKING_DATASET_S3_PREFIX
store = _AppObjectStore()
mirror = _AppObjectStore() if mirrored else None
- capture = _run_serving_manifest(monkeypatch, store, mirror=mirror)
+ dataset = _serving_dataset_s3(prefix, "2026-08-19", model_kind=model_kind)
+ capture = _run_serving_manifest(monkeypatch, store, mirror=mirror, dataset_client=dataset)
manifest = ServingManifest.model_validate_json(store.objects[serving_manifest_key(prefix)])
assert manifest.served.key == model_key(EMBEDDINGS_MODEL_NAME, "2026-08-15")
- # Every entry the manifest names has its record and its booster in the store the sweep reads.
+ # Every entry the manifest names has its record and its model file in the store the sweep reads.
for entry in manifest.models:
+ assert (entry.model_kind, entry.heads, entry.files) == (model_kind, ["open"], [model_file])
assert f"{entry.prefix}/{METADATA_FILE}" in store.objects
- assert f"{entry.prefix}/open.ubj" in store.objects
+ assert f"{entry.prefix}/{model_file}" in store.objects
assert store.written[-1] == serving_manifest_key(prefix)
if mirror is not None:
assert mirror.objects == store.objects
@@ -2969,7 +2995,7 @@ def test_a_missing_pin_is_dropped_and_the_manifest_still_publishes(monkeypatch):
assert manifest.served.key == model_key(EMBEDDINGS_MODEL_NAME, "2026-08-15")
_, dropped = _pinned_models(denied_client, "bucket", prefix, pins)
assert dropped.keys() == set(pins)
- assert "missing boosters" in dropped[missing_key]
+ assert "missing model files" in dropped[missing_key]
assert METADATA_FILE in dropped[absent_key]
assert "AccessDenied" in dropped[denied_key]
assert "this build can produce" in dropped[retired_key]
diff --git a/products/signals/dags/inbox_ranking/training/dag.py b/products/signals/dags/inbox_ranking/training/dag.py
index 964f3fe403dd..cb89f8b16008 100644
--- a/products/signals/dags/inbox_ranking/training/dag.py
+++ b/products/signals/dags/inbox_ranking/training/dag.py
@@ -1031,14 +1031,14 @@ def _pin_metadata(client, bucket: str, prefix: str, key: str) -> tuple[dict[str,
mismatch = model_mismatch(metadata)
if mismatch is not None:
return None, mismatch
- heads = trained_head_files(metadata, HEADS_BY_NAME)
+ files = sorted(set(trained_head_files(metadata, HEADS_BY_NAME).values()))
missing = [
- f"{head}.ubj"
- for head in sorted(heads)
- if not _object_exists(client, bucket, model_object_key(prefix, model_name, model_version, f"{head}.ubj"))
+ name
+ for name in files
+ if not _object_exists(client, bucket, model_object_key(prefix, model_name, model_version, name))
]
- if not heads or missing:
- return None, f"missing boosters {missing}" if missing else "no trained head"
+ if not files or missing:
+ return None, f"missing model files {missing}" if missing else "no trained head"
return metadata, None
@@ -1095,8 +1095,8 @@ def publish_serving_models(
if target.storage.head_object(bucket=target.bucket, file_key=target_metadata) is not None:
present.append(entry.key)
continue
- # Metadata marks a complete copy, so write it after every booster to make retries safe.
- for name in (*(f"{head}.ubj" for head in entry.heads), METADATA_FILE):
+ # Metadata marks a complete copy, so write it after every model file to make retries safe.
+ for name in (*entry.files, METADATA_FILE):
body = _read_bytes_if_exists(
client, bucket, model_object_key(prefix, entry.model_name, entry.model_version, name)
)
diff --git a/products/signals/dags/inbox_ranking/training/serving.py b/products/signals/dags/inbox_ranking/training/serving.py
index 6064246a6128..ea73357c465c 100644
--- a/products/signals/dags/inbox_ranking/training/serving.py
+++ b/products/signals/dags/inbox_ranking/training/serving.py
@@ -22,6 +22,8 @@ from products.signals.backend.ranking.serving_manifest import (
CROSS_FAMILY_ROLE,
DAILY_CANDIDATE_ROLE,
DEFAULT_MODEL_KIND,
+ ONNX_MODEL_FILE,
+ ONNX_MODEL_KIND,
PINNED_ROLE,
SERVED_ROLE,
ServingManifest,
@@ -60,22 +62,24 @@ def _entry(
prefix: str,
) -> ServingManifestEntry | None:
"""One manifest entry, or None when the model has no head a store could load. Only the refit
- boosters are named: the holdout fits grade a promotion and never serve."""
+ models are named: the holdout fits grade a promotion and never serve."""
heads = sorted(trained_head_files(metadata, HEADS_BY_NAME))
if not heads:
return None
key = model_key(metadata["model_name"], metadata["model_version"])
+ # A model published before the field existed is per-head XGBoost, so the old default reads
+ # as what it is rather than as missing.
+ model_kind = metadata.get("model_kind") or DEFAULT_MODEL_KIND
return ServingManifestEntry(
key=key,
model_name=metadata["model_name"],
model_version=metadata["model_version"],
- # A model published before the field existed is per-head XGBoost, so the old default reads
- # as what it is rather than as missing.
- model_kind=metadata.get("model_kind") or DEFAULT_MODEL_KIND,
+ model_kind=model_kind,
roles=list(roles),
labels=dict(labels),
prefix=serving_model_prefix(prefix, key),
heads=heads,
+ model_file=ONNX_MODEL_FILE if model_kind == ONNX_MODEL_KIND else None,
)
diff --git a/pyproject.toml b/pyproject.toml
index 92969e367a57..af260f1b39cc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -161,6 +161,8 @@ dependencies = [
"tbb==2022.3.1; sys_platform == 'linux' and platform_machine == 'x86_64'",
"whitenoise~=6.10.0",
"xgboost==3.2.0",
+ # CPU inference for the inbox ranking network. Keep in step with the `inbox-ranking` training group.
+ "onnxruntime~=1.30.0",
"xmlsec==1.3.17",
"zstd==1.5.7.2",
"zxcvbn==4.5.0",
@@ -304,7 +306,7 @@ sentiment = [
# no image installs it. torch comes from the CPU wheel index, see [tool.uv.sources].
inbox-ranking = [
"onnx~=1.21.0",
- "onnxruntime~=1.24.1",
+ "onnxruntime~=1.30.0",
"torch~=2.9.0",
]
hogql-parser-parity = [
diff --git a/uv.lock b/uv.lock
index 5a62bfe8edd8..de51bed642c9 100644
--- a/uv.lock
+++ b/uv.lock
@@ -4854,7 +4854,7 @@ name = "nvidia-cudnn-cu12"
version = "9.10.2.21"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "nvidia-cublas-cu12", marker = "sys_platform != 'emscripten'" },
+ { name = "nvidia-cublas-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },
]
wheels = [
{ url = "https://files.pythonhosted.org/packages/fa/41/e79269ce215c857c935fd86bcfe91a451a584dfc27f1e068f568b9ad1ab7/nvidia_cudnn_cu12-9.10.2.21-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:c9132cc3f8958447b4910a1720036d9eff5928cc3179b0a51fb6d167c6cc87d8", size = 705026878, upload-time = "2025-06-06T21:52:51.348Z" },
@@ -4867,7 +4867,7 @@ name = "nvidia-cufft-cu12"
version = "11.3.3.83"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "nvidia-nvjitlink-cu12", marker = "sys_platform != 'emscripten'" },
+ { name = "nvidia-nvjitlink-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },
]
wheels = [
{ url = "https://files.pythonhosted.org/packages/60/bc/7771846d3a0272026c416fbb7e5f4c1f146d6d80704534d0b187dd6f4800/nvidia_cufft_cu12-11.3.3.83-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:848ef7224d6305cdb2a4df928759dca7b1201874787083b6e7550dd6765ce69a", size = 193109211, upload-time = "2025-03-07T01:44:56.873Z" },
@@ -4899,9 +4899,9 @@ name = "nvidia-cusolver-cu12"
version = "11.7.3.90"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "nvidia-cublas-cu12", marker = "sys_platform != 'emscripten'" },
- { name = "nvidia-cusparse-cu12", marker = "sys_platform != 'emscripten'" },
- { name = "nvidia-nvjitlink-cu12", marker = "sys_platform != 'emscripten'" },
+ { name = "nvidia-cublas-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },
+ { name = "nvidia-cusparse-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },
+ { name = "nvidia-nvjitlink-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },
]
wheels = [
{ url = "https://files.pythonhosted.org/packages/c8/32/f7cd6ce8a7690544d084ea21c26e910a97e077c9b7f07bf5de623ee19981/nvidia_cusolver_cu12-11.7.3.90-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:db9ed69dbef9715071232caa9b69c52ac7de3a95773c2db65bdba85916e4e5c0", size = 267229841, upload-time = "2025-03-07T01:46:54.356Z" },
@@ -4914,7 +4914,7 @@ name = "nvidia-cusparse-cu12"
version = "12.5.8.93"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "nvidia-nvjitlink-cu12", marker = "sys_platform != 'emscripten'" },
+ { name = "nvidia-nvjitlink-cu12", marker = "platform_machine != 's390x' and sys_platform != 'emscripten'" },
]
wheels = [
{ url = "https://files.pythonhosted.org/packages/bc/f7/cd777c4109681367721b00a106f491e0d0d15cfa1fd59672ce580ce42a97/nvidia_cusparse_cu12-12.5.8.93-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:9b6c161cb130be1a07a27ea6923df8141f3c295852f4b260c65f18f3e0a091dc", size = 288117129, upload-time = "2025-03-07T01:47:40.407Z" },
@@ -5006,22 +5006,22 @@ wheels = [
[[package]]
name = "onnxruntime"
-version = "1.24.1"
+version = "1.30.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "flatbuffers" },
{ name = "numpy" },
{ name = "packaging" },
{ name = "protobuf" },
- { name = "sympy" },
]
wheels = [
- { url = "https://files.pythonhosted.org/packages/87/23/167d964414cee2af9c72af323b28d2c4cb35beed855c830a23f198265c79/onnxruntime-1.24.1-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:890c503ca187bc883c3aa72c53f2a604ec8e8444bdd1bf6ac243ec6d5e085202", size = 17214004, upload-time = "2026-02-05T17:31:11.917Z" },
- { url = "https://files.pythonhosted.org/packages/b4/24/6e5558fdd51027d6830cf411bc003ae12c64054826382e2fab89e99486a0/onnxruntime-1.24.1-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4da1b84b3bdeec543120df169e5e62a1445bf732fc2c7fb036c2f8a4090455e8", size = 15017034, upload-time = "2026-02-05T17:31:04.331Z" },
- { url = "https://files.pythonhosted.org/packages/91/d4/3cb1c9eaae1103265ed7eb00a3eaeb0d9ba51dc88edc398b7071c9553bed/onnxruntime-1.24.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:557753ec345efa227c6a65139f3d29c76330fcbd54cc10dd1b64232ebb939c13", size = 17097531, upload-time = "2026-02-05T17:31:40.303Z" },
- { url = "https://files.pythonhosted.org/packages/0f/da/4522b199c12db7c5b46aaf265ee0d741abe65ea912f6c0aaa2cc18a4654d/onnxruntime-1.24.1-cp314-cp314-win_amd64.whl", hash = "sha256:ea4942104805e868f3ddddfa1fbb58b04503a534d489ab2d1452bbfa345c78c2", size = 12795556, upload-time = "2026-02-05T17:32:11.886Z" },
- { url = "https://files.pythonhosted.org/packages/a1/53/3b8969417276b061ff04502ccdca9db4652d397abbeb06c9f6ae05cec9ca/onnxruntime-1.24.1-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ea8963a99e0f10489acdf00ef3383c3232b7e44aa497b063c63be140530d9f85", size = 15025434, upload-time = "2026-02-05T17:31:06.942Z" },
- { url = "https://files.pythonhosted.org/packages/ab/a2/cfcf009eb38d90cc628c087b6506b3dfe1263387f3cbbf8d272af4fef957/onnxruntime-1.24.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34488aa760fb5c2e6d06a7ca9241124eb914a6a06f70936a14c669d1b3df9598", size = 17099815, upload-time = "2026-02-05T17:31:43.092Z" },
+ { url = "https://files.pythonhosted.org/packages/6a/03/05c9a9234688757d2876ddecf80bba908561ee11debf125bc1a427ae6f48/onnxruntime-1.30.0-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:8b6169c16a48429890d2f4a0c774ebf54dfe9066a998514aad0518a16d398547", size = 21545313, upload-time = "2026-09-10T16:31:59.654Z" },
+ { url = "https://files.pythonhosted.org/packages/c6/bc/1069e58b24779ba9d2fd479db5ecb3a15a6f49b585107c898819c0789558/onnxruntime-1.30.0-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:d2184fddb6798136e7c478244391ca82443f5c757f59f15bb9e5ad2da5e03175", size = 21346830, upload-time = "2026-09-10T16:32:02.275Z" },
+ { url = "https://files.pythonhosted.org/packages/f1/38/8138eed225c5bc6ddfc05879ecac7dacc63c34b9b6f99be72839c1f6dc49/onnxruntime-1.30.0-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:8b611d24db2954545ce6bd9acd4670183cb368e4642450de7a9ab6474eb374ec", size = 23586333, upload-time = "2026-09-10T16:32:04.996Z" },
+ { url = "https://files.pythonhosted.org/packages/4d/0a/748b86000fbf9518b5dfc5bdc1b924eeaca976203740fd9d30649e568ee6/onnxruntime-1.30.0-cp314-cp314-win_amd64.whl", hash = "sha256:3bdd1752a8502ac1a7ccc6e878d16db6943df574d54ed7f01058a6806ae05be4", size = 14675319, upload-time = "2026-09-10T16:32:07.5Z" },
+ { url = "https://files.pythonhosted.org/packages/2f/db/db8e4c0cf6f70f1311060560630fd21763648e01dfbba5195a2592c052ef/onnxruntime-1.30.0-cp314-cp314-win_arm64.whl", hash = "sha256:83d543843cbd352cfa9996a6c7b92f8a480f114a18f95ff2a1acaf6921e85b6d", size = 14569360, upload-time = "2026-09-10T16:32:09.896Z" },
+ { url = "https://files.pythonhosted.org/packages/24/0a/ec0a9d656e39b43887c378a5388b20c3b1e1ee43bded84580b0936466694/onnxruntime-1.30.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:265de607ba6f9814264e1d5d413fa7069d70f48e3049b5e460b3b04bdfcef294", size = 21348433, upload-time = "2026-09-10T16:32:12.772Z" },
+ { url = "https://files.pythonhosted.org/packages/91/f0/40f74b7c00077e1e25627067ed98a70df1fef5c0e21b82849190d312554e/onnxruntime-1.30.0-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:67ad7f03433b6462c627d0f555dece80e6a26bc71e8542ced35cebd32142d1b7", size = 23579340, upload-time = "2026-09-10T16:32:15.532Z" },
]
[[package]]
@@ -5923,6 +5923,7 @@ dependencies = [
{ name = "natsort" },
{ name = "nh3" },
{ name = "numpy" },
+ { name = "onnxruntime" },
{ name = "openai" },
{ name = "openpyxl" },
{ name = "opentelemetry-exporter-otlp-proto-grpc" },
@@ -6219,6 +6220,7 @@ requires-dist = [
{ name = "natsort", specifier = "==8.4.0" },
{ name = "nh3", specifier = "==0.3.5" },
{ name = "numpy", specifier = "~=2.3.2" },
+ { name = "onnxruntime", specifier = "~=1.30.0" },
{ name = "openai", specifier = "==2.30.0" },
{ name = "openpyxl", specifier = "==3.1.5" },
{ name = "opentelemetry-exporter-otlp-proto-grpc", specifier = "==1.35.0" },
@@ -6381,7 +6383,7 @@ dev = [
hogql-parser-parity = [{ name = "shrinkray", specifier = "==26.4.14.0" }]
inbox-ranking = [
{ name = "onnx", specifier = "~=1.21.0" },
- { name = "onnxruntime", specifier = "~=1.24.1" },
+ { name = "onnxruntime", specifier = "~=1.30.0" },
{ name = "torch", specifier = "~=2.9.0", index = "https://download.pytorch.org/whl/cpu", conflict = { package = "posthog", group = "inbox-ranking" } },
]
proto-codegen = [
@@ -7955,7 +7957,7 @@ name = "shadowcopy"
version = "0.0.4"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "wmi", marker = "sys_platform != 'emscripten' or (extra == 'group-7-posthog-inbox-ranking' and extra == 'group-7-posthog-sentiment')" },
+ { name = "wmi", marker = "(platform_machine == 's390x' and sys_platform == 'darwin') or (platform_python_implementation == 'PyPy' and sys_platform == 'darwin') or (platform_python_implementation != 'PyPy' and sys_platform == 'darwin' and extra != 'group-7-posthog-inbox-ranking') or (platform_python_implementation != 'PyPy' and sys_platform == 'darwin' and extra == 'group-7-posthog-inbox-ranking' and extra == 'group-7-posthog-sentiment') or (sys_platform != 'darwin' and sys_platform != 'emscripten') or (sys_platform == 'emscripten' and extra == 'group-7-posthog-inbox-ranking' and extra == 'group-7-posthog-sentiment')" },
]
sdist = { url = "https://files.pythonhosted.org/packages/12/44/c00420a3b7bcdf830529b933392b566c876a4944a24f31e126eb6fd28647/shadowcopy-0.0.4.tar.gz", hash = "sha256:ed89817dda065f893607a04c0b7d6b3b34c3507a4711f441111a4bcb1b1826c0", size = 4138, upload-time = "2023-07-08T00:01:35.266Z" }
wheels = [
@@ -8402,7 +8404,7 @@ name = "tbb"
version = "2022.3.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "tcmlib" },
+ { name = "tcmlib", marker = "(platform_machine != 's390x' and platform_python_implementation == 'PyPy' and sys_platform == 'darwin') or (platform_machine != 's390x' and sys_platform != 'darwin' and sys_platform != 'emscripten') or (platform_machine != 's390x' and sys_platform == 'darwin' and extra != 'group-7-posthog-inbox-ranking') or (platform_machine == 's390x' and sys_platform != 'emscripten' and extra != 'group-7-posthog-inbox-ranking' and extra != 'group-7-posthog-sentiment') or (platform_machine == 's390x' and extra == 'group-7-posthog-inbox-ranking' and extra == 'group-7-posthog-sentiment') or (platform_python_implementation != 'PyPy' and sys_platform == 'darwin' and extra == 'group-7-posthog-inbox-ranking' and extra == 'group-7-posthog-sentiment') or (sys_platform == 'darwin' and extra != 'group-7-posthog-inbox-ranking' and extra != 'group-7-posthog-sentiment') or (sys_platform == 'emscripten' and extra == 'group-7-posthog-inbox-ranking' and extra == 'group-7-posthog-sentiment')" },
]
wheels = [
{ url = "https://files.pythonhosted.org/packages/08/59/8d381a2cfe8d36c4f4ff9f94769ff2809bfc16014d888360b0e24c7e5c6b/tbb-2022.3.1-py2.py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:534c089eca6bcf148408684c156229d5f09c01d323b685b15739f41985b529d7", size = 4178630, upload-time = "2026-01-22T05:30:20.589Z" },
@@ -9627,7 +9629,7 @@ name = "wmi"
version = "1.5.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
- { name = "pywin32", marker = "sys_platform != 'emscripten' or (extra == 'group-7-posthog-inbox-ranking' and extra == 'group-7-posthog-sentiment')" },
+ { name = "pywin32", marker = "(platform_machine == 's390x' and sys_platform == 'darwin') or (platform_python_implementation == 'PyPy' and sys_platform == 'darwin') or (platform_python_implementation != 'PyPy' and sys_platform == 'darwin' and extra != 'group-7-posthog-inbox-ranking') or (platform_python_implementation != 'PyPy' and sys_platform == 'darwin' and extra == 'group-7-posthog-inbox-ranking' and extra == 'group-7-posthog-sentiment') or (sys_platform != 'darwin' and sys_platform != 'emscripten') or (sys_platform == 'emscripten' and extra == 'group-7-posthog-inbox-ranking' and extra == 'group-7-posthog-sentiment')" },
]
sdist = { url = "https://files.pythonhosted.org/packages/d4/66/6364deb0a03415f96c66803d8c4379f808f2401da3bdb183348487b10510/WMI-1.5.1.tar.gz", hash = "sha256:b6a6be5711b1b6c8d55bda7a8befd75c48c12b770b9d227d31c1737dbf0d40a6", size = 26254, upload-time = "2020-04-28T08:22:58.096Z" }
wheels = [