Skip to content
This repository was archived by the owner on Oct 10, 2026. It is now read-only.

feat(007): trained inference path for seed-morph78 - #105

Closed
scrimshawlife-ctrl wants to merge 5 commits into
mainfrom
cursor/hyperlexical-infer-model-41af
Closed

scrimshawlife-ctrl wants to merge 5 commits into
mainfrom
cursor/hyperlexical-infer-model-41af

Conversation

@scrimshawlife-ctrl

@scrimshawlife-ctrl scrimshawlife-ctrl commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Superseded

Closing as superseded by merged #106 (feat(007): trained inference path for seed-morph78). This branch is dirty vs current main and should not be merged.

Post-rc1 HOLD docs sync continues in a separate PR from cursor/post-rc1-hold-sync-273d.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +138 to +140
for i, token in enumerate(tokens):
idxs = pool_indices(states.size(0), atom_token_index(text, token, offs))
h = states[idxs].mean(0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +130 to +132
tokens = text.split()
with torch.no_grad():
enc = tok([text], truncation=True, max_length=MAX_LEN, return_tensors="pt")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +108 to +112
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@scrimshawlife-ctrl
scrimshawlife-ctrl changed the base branch from cursor/hyperlexical-card-rename-41af to main September 24, 2026 19:27
scrimshawlife-ctrl added a commit that referenced this pull request Sep 24, 2026
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.
@scrimshawlife-ctrl

Copy link
Copy Markdown
Owner Author

Closing as superseded by merged #106. Infer path is on main. Post-rc1 HOLD docs sync: #126.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant