SemIf's shared scorer trims one token at the state boundary. When an object state's last value ends in ')', ';' or '}', the JSON that follows re-merges two tokens back, so score_shared refused the request with 422. The engine now wraps semif_phase1.shared._state_prefix to keep only the tokens the full prompts share. Each row scores the same token sequence; only the prefill/suffix split moves. Startup proves the fix is in effect, not just installed (heid bug hunt SKAL, folded). It checks that the hook is callable and is what score_shared resolves, that an ordinary state keeps upstream's whole prefix, and that a merge-prone state scores through the shared path. Real tokenizer: 154 states, 23 refused before and 0 after, with no ordinary or authored144 prefix changed. Acceptance: 144/144 parity. Shared vs direct 71/72; the miss is a bf16 tie that flipped across a plain restart (see README).
47 lines
1.5 KiB
TOML
47 lines
1.5 KiB
TOML
[project]
|
|
name = "semif-serve"
|
|
version = "0.1.4"
|
|
description = "HTTP wrapper around SemIf's direct and shared option-logit scorers"
|
|
requires-python = ">=3.12"
|
|
dependencies = [
|
|
"fastapi==0.118.0",
|
|
"uvicorn==0.37.0",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
# The real engine. Pulls torch 2.10.0 (cu128) and transformers 5.17.0 through SemIf's exact pins.
|
|
model = [
|
|
"semif-phase1 @ git+https://github.com/TheoLeeCJ/SemIf-OpenJev@23cf1f39fc9534fe81437200959b6dfc7106e45a",
|
|
# Same pin SemIf declares, taken from the cu128 index: SemIf's committed predictions report
|
|
# torch 2.10.0+cu128, and cu128 carries sm_120 kernels for the Blackwell cards.
|
|
"torch==2.10.0",
|
|
]
|
|
|
|
# Qwen3.5's fast kernels. Without them transformers runs its reference PyTorch paths
|
|
# ("correct but much slower"). Trialled 2026-09-27; adopted only if parity with upstream holds.
|
|
fast = [
|
|
"flash-linear-attention==0.5.2",
|
|
"causal-conv1d @ https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.7.0/causal_conv1d-1.7.0+cu12torch2.10cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; sys_platform == 'linux' and platform_machine == 'x86_64'",
|
|
]
|
|
|
|
[dependency-groups]
|
|
dev = ["pytest==8.4.2", "httpx==0.28.1"]
|
|
|
|
[build-system]
|
|
requires = ["setuptools>=68"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[tool.setuptools.packages.find]
|
|
where = ["src"]
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
|
|
[[tool.uv.index]]
|
|
name = "pytorch-cu128"
|
|
url = "https://download.pytorch.org/whl/cu128"
|
|
explicit = true
|
|
|
|
[tool.uv.sources]
|
|
torch = { index = "pytorch-cu128" }
|