Skip to content

Add wov invnorm norm and extend slerp range - #865

Merged
gkielian merged 3 commits into
ReaLLMASIC:masterfrom
klei22:add-wov-invnorm-norm-and-extend-slerp-range
Jul 22, 2026
Merged

Add wov invnorm norm and extend slerp range#865
gkielian merged 3 commits into
ReaLLMASIC:masterfrom
klei22:add-wov-invnorm-norm-and-extend-slerp-range

Conversation

@klei22

@klei22 klei22 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI 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.

Pull request overview

This PR expands the hf-vocab-sphere vector expression system to support model-aware functions (norm, invnorm, wov), extends SLERP to allow finite extrapolation (t outside [0, 1]), and adds a frontend toggle to display vector magnitudes in labels.

Changes:

  • Allow finite SLERP extrapolation and update the UI/control contract accordingly.
  • Add model-backed vector functions (norm, invnorm, wov) with support for nesting inside expressions.
  • Add a “show label magnitudes” appearance setting and wire it through UI + settings persistence.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
report/threejs/hf-vocab-sphere/tests/test_vector_math.py Updates SLERP expectations and adds coverage for nested model-function calls in expressions.
report/threejs/hf-vocab-sphere/tests/test_frontend_contract.py Extends contract checks for the new magnitude-label toggle and hotkey/settings wiring.
report/threejs/hf-vocab-sphere/app/vector_math.py Extends the safe evaluator to support string args + model functions and relaxes SLERP’s t constraints.
report/threejs/hf-vocab-sphere/app/templates/index.html Updates SLERP input UX and adds magnitude-label toggle + hotkey documentation.
report/threejs/hf-vocab-sphere/app/static/app.js Implements magnitude label rendering, updates SLERP fraction handling, and persists new appearance setting.
report/threejs/hf-vocab-sphere/app/model_store.py Adds auxiliary tensor loading + caching and implements norm/invnorm/wov backend operations.
report/threejs/hf-vocab-sphere/app/main.py Wires projection arithmetic evaluation to the model-backed vector function implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +137 to +141
if isinstance(node, ast.Constant) and isinstance(node.value, str):
text = node.value.strip().casefold()
if not text or len(text) > 40:
raise ValueError("String arguments must be short, non-blank selectors.")
return _Value("string", text)
Comment on lines 58 to +60
fraction = float(t)
if not math.isfinite(fraction) or fraction < 0.0 or fraction > 1.0:
raise ValueError("SLERP t must be a finite scalar in the interval [0, 1].")
if not math.isfinite(fraction):
raise ValueError("SLERP t must be a finite scalar.")
Comment on lines +988 to +996
_AUX_TENSOR_CACHE: dict[tuple[str, str, bool], dict[str, torch.Tensor]] = {}


def _all_safetensor_tensors(model_name: str, *, revision: str, allow_download: bool = True) -> dict[str, torch.Tensor]:
cache_key = (model_name, revision, allow_download)
cached = _AUX_TENSOR_CACHE.get(cache_key)
if cached is not None:
return cached
tensors: dict[str, torch.Tensor] = {}
@gkielian
gkielian merged commit ba655ce into ReaLLMASIC:master Jul 22, 2026
2 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants