Repository navigation
feat(007): trained inference path for seed-morph78 - #105
scrimshawlife-ctrl wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02182076f5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for i, token in enumerate(tokens): | ||
| idxs = pool_indices(states.size(0), atom_token_index(text, token, offs)) | ||
| h = states[idxs].mean(0) |
There was a problem hiding this comment.
Track each repeated token occurrence when pooling
For inputs containing repeated atoms, such as the settled slang pattern fr fr no cap, atom_token_index(text, token, offs) resolves every identical token through char_span, which always returns its first occurrence. The later atom is therefore classified from the first token's hidden state, producing incorrect positional role and potentially filler predictions; pass the current whitespace occurrence span/index rather than searching again by token text.
Useful? React with 👍 / 👎.
| tokens = text.split() | ||
| with torch.no_grad(): | ||
| enc = tok([text], truncation=True, max_length=MAX_LEN, return_tensors="pt") |
There was a problem hiding this comment.
Stop emitting atoms beyond the truncated model input
When an input exceeds MAX_LEN subword tokens, the encoder and offset map are truncated, but this loop still emits every whitespace token from the original text. For each token beyond the retained offsets, atom_token_index returns no indices and pool_indices silently falls back to token index 1, so the packet reports role/filler predictions for unseen text using the first lexical state. Long inputs should be rejected, explicitly marked truncated, or limited to atoms represented by the retained offsets.
Useful? React with 👍 / 👎.
| raise InferModelError("family probabilities do not match families") | ||
| best = max(range(len(families)), key=lambda i: family_probs[i]) | ||
| vector_blob = ",".join(f"{v:.6f}" for v in vector).encode("utf-8") | ||
| unbind_ok = bool(atoms) and all(a["filler_pred"] == a["filler"] for a in atoms) |
There was a problem hiding this comment.
Include role predictions in unbind success
Whenever the filler head reconstructs every token but the role head predicts any wrong position, this expression still reports unbind_ok: true. That misstates successful role–filler recovery even though the packet exposes both role and role_pred; require both the role and filler predictions to match for every atom.
Useful? React with 👍 / 👎.
| split = split_weight_tensors(load_file(str(weight), device="cpu")) | ||
| maps = _load_maps(model_dir, None) | ||
| tok, encoder = _load_trunk(trunk_dir, model_dir) | ||
| except (TrunkForwardError, ImportError) as exc: | ||
| raise InferModelError(str(exc)) from exc |
There was a problem hiding this comment.
Convert checkpoint parsing failures to InferModelError
If model.safetensors exists but is truncated, corrupt, or otherwise unreadable, load_file raises SafetensorError, which is not covered by this handler. It escapes through infer_main because the CLI catches only InferModelError, yielding a traceback rather than the documented fail-closed JSON response and exit code 2; checkpoint parsing and compatible state-loading failures should be wrapped as InferModelError.
Useful? React with 👍 / 👎.
hyperlexical.infer --model-dir runs a local trained checkpoint and emits a MODEL_EMBEDDING packet; only the approved pin carries hyperlex-structure-149m. Spark receipt included. Supersedes #105.
Superseded
Closing as superseded by merged #106 (
feat(007): trained inference path for seed-morph78). This branch is dirty vs currentmainand should not be merged.Post-rc1 HOLD docs sync continues in a separate PR from
cursor/post-rc1-hold-sync-273d.