Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.
Python calibrationclassificationdecision-modelhuggingfacejevmodernbertmultilingualnlppythonpytorchroutingtyped-decisionszero-shot
test(hooks): witness the call-site half of the warning dedup key
Aashish79bc1b6c12ac
diff --git a/docs/hooks/errors.md b/docs/hooks/errors.mdindex 7371ddcf..c84c5064 100644--- a/docs/hooks/errors.md+++ b/docs/hooks/errors.md@@ -139,8 +139,9 @@ noisy under load.What counts as distinct is the message text, and that text names the hook's *type* and the event. So twodifferent hook classes failing in the same call are two lines, and one hook failing on both events is twolines -- but two instances of the *same* class failing the same way are one line, because they produce the-same string. A single hook failing from two different call sites is two lines as well; the call site is the-other half of the key.+same string. The warning's recorded location is the other half of the key, and each entry point calls+`dispatch` from its own line: the same hook failing from an `Agent` call and from a `Router` call is the+same text at two different locations, and prints twice.So the warning stream is not a failure counter. If the rate matters, count inside the hook, or set`hooks_raise=True` and handle the exception. To make the repeats print, a caller has to widen thediff --git a/tests/test_hooks.py b/tests/test_hooks.pyindex 063af4c3..d04015db 100644--- a/tests/test_hooks.py+++ b/tests/test_hooks.py@@ -296,6 +296,37 @@ check("warnings/one hook failing on both events is two lines",["laya: hook WarnBothEvents.on_predict_start failed","laya: hook WarnBothEvents.on_predict_end failed"])+# And the call site is the other half of the key: the same hook failing from two different dispatch+# lines -- an Agent call and a Router call -- has byte-identical text and still prints twice.+class WarnTwoSites:+ def on_predict_start(self, ctx):+ raise ValueError("same text")+++class WarnRouteFake:+ """The smallest thing a Router will attach: a `predict_batch` that answers."""++ def predict_batch(self, states, questions, batch_size=None, **overrides):+ return [{"model": "fake", "answers": {"seen": s},+ "usage": {"input_tokens": len(s), "output_tokens": 0}} for s in states]++ def system_one(self, state, questions, **overrides):+ return self.predict_batch([state], questions, **overrides)[0]+++two_sites = WarnTwoSites()+f = make_fake()+with warnings.catch_warnings(record=True) as sites:+ warnings.simplefilter("default")+ f.predict_batch(["s0"], QUESTIONS, hooks=[two_sites], hooks_raise=False)+ rr = Router()+ rr.attach("english", WarnRouteFake())+ rr.predict_batch([{"state": "a", "questions": QUESTIONS, "model": "english"}],+ hooks=[two_sites], hooks_raise=False)+check("warnings/the same text from two call sites prints twice", len(sites), 2)+check("warnings/and the identical texts come from different sites",+ len({(os.path.basename(w.filename), w.lineno) for w in sites}), 2)+class ErrHook:def __init__(self):