Mechanical conversion of every relative import under v2/ to an absolute v2.* path (from .x / ..x / ...x -> from v2.<pkg>.x) so imports are unambiguous, grep-able, and stable when code is copied/moved between entrypoints (VideoGenerator, CLI, server). Surgical prefix-only rewrite: only the 'from <dots><module>' prefix changed — import names, parentheses, multi-line formatting, comments, and ordering are byte-for-byte preserved (no collapsing, no reorder, no unrelated reformatting). - 471 imports across 125 files; v2/tests/ was already absolute (untouched). - Validated: all 125 files compile, every 'from v2.* import' target resolves to a real module/package, zero relative imports remain (full sweep), CPU mini suite green (202 passed, 2 skipped).
20 lines
902 B
Python
20 lines
902 B
Python
"""Speculative-decoding program: tokenize → spec_decode (draft+verify) → emit_text (design_v3 §9.16)."""
|
|
from __future__ import annotations
|
|
|
|
from v2.program import ComponentNode, ModelLoopNode, Program, ProgramKind
|
|
from v2.models.omni import emit_text_node, tokenize_node
|
|
|
|
|
|
def build_speculative_program() -> Program:
|
|
return Program(
|
|
program_id="speculative.decode", kind=ProgramKind.INLINE,
|
|
nodes=[
|
|
ComponentNode("tokenize", fn=tokenize_node, writes=("prompt_tokens",)),
|
|
ModelLoopNode("spec", loop_id="spec_decode", output_slot="spec_out",
|
|
reads=("prompt_tokens",), writes=("spec_out",)),
|
|
ComponentNode("emit_text", fn=emit_text_node("spec_out", "text"),
|
|
reads=("spec_out",), writes=("text",)),
|
|
],
|
|
output_artifacts={"text": "text", "tokens": "spec_out"},
|
|
).validate()
|