Skip to content

delete useless code - #168

Open
superxf wants to merge 1 commit into
hw-native-sys:mainfrom
superxf:de_code
Open

delete useless code#168
superxf wants to merge 1 commit into
hw-native-sys:mainfrom
superxf:de_code

Conversation

@superxf

@superxf superxf commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Remove unused compatibility and placeholder code, including the legacy worker wrapper, request-state re-export, streaming placeholder, unused KV cache container, and obsolete runner warm-up methods.
  • Consolidate shared completion and chat-completion request fields, generation configuration, non-streaming result collection, streaming delta handling, and usage reporting in the HTTP server.
  • Add chat-template rendering to TokenizerAdapter so the serving layer no longer reaches into the wrapped Hugging Face tokenizer.
  • Exclude Git submodules from Ruff scans so the documented repository-wide lint command does not report errors from third-party sources.

The OpenAI-compatible endpoint fields and response/SSE shapes are preserved.

Testing

  • python -m pytest tests/unit -q
  • ruff check --config ruff.toml .
  • python tests/lint/check_headers.py
  • python tests/lint/check_english_only.py
  • git diff --check

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f26907ab-edf6-4deb-988c-08553f9f5837


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

lterrac added a commit to lterrac/pypto-serving that referenced this pull request Aug 20, 2026
hw-native-sys#163 step 7, as much of it as is safe to do while several PRs are open against the
files the rest of it would touch.

`RuntimeModel.layers` is now defaulted and empty for every loader in the tree, and
`LayerWeights` is documented as deprecated with a pointer to what replaced it. Both are
kept rather than deleted on purpose: hw-native-sys#168, hw-native-sys#114, hw-native-sys#152, hw-native-sys#145, hw-native-sys#144 and hw-native-sys#132 are open, and
some construct a `RuntimeModel`. Removing the field would break them for no gain that
cannot wait — it goes when they have landed.

`--num-layers-override` in the Qwen example loses its `runtime_model.layers[:n]` slice,
which had quietly become a no-op: staging reads `config.num_hidden_layers` and pulls
exactly that many layers from the checkpoint, so replacing the config *is* the override
now. The knob still works; there is simply nothing eager left to truncate.

**The `stage_weights` hook is deliberately not added, and the reason is worth recording
because the issue asks for it.** hw-native-sys#163 proposes it "between `_create_runner` and
`init_kv_cache`", motivated by Qwen's `DistributedWorker` forking inside
`init_kv_cache` — so staging must happen before that. Checking the actual order in
`PyptoExecutor.register_model`, it already does: `_compile_model` runs first, and Qwen
stages inside it, well ahead of `_create_runner` and the fork. The constraint the hook
exists to satisfy is met without it.

That leaves the hook as an architectural tidy-up — separating "compile kernels" from
"stage weights" into named phases — and it would touch `common/runner/model_runner.py`
plus both `npu_runner.py`, which is exactly where the six open PRs are. Adding surface
to the most contested files in the repo to formalise a phase ordering that already holds
is a poor trade this week. Worth doing after they land, with the timing rationale
restated then rather than assumed.
lterrac added a commit to lterrac/pypto-serving that referenced this pull request Aug 21, 2026
hw-native-sys#163 step 7, as much of it as is safe to do while several PRs are open against the
files the rest of it would touch.

`RuntimeModel.layers` is now defaulted and empty for every loader in the tree, and
`LayerWeights` is documented as deprecated with a pointer to what replaced it. Both are
kept rather than deleted on purpose: hw-native-sys#168, hw-native-sys#114, hw-native-sys#152, hw-native-sys#145, hw-native-sys#144 and hw-native-sys#132 are open, and
some construct a `RuntimeModel`. Removing the field would break them for no gain that
cannot wait — it goes when they have landed.

`--num-layers-override` in the Qwen example loses its `runtime_model.layers[:n]` slice,
which had quietly become a no-op: staging reads `config.num_hidden_layers` and pulls
exactly that many layers from the checkpoint, so replacing the config *is* the override
now. The knob still works; there is simply nothing eager left to truncate.

**The `stage_weights` hook is deliberately not added, and the reason is worth recording
because the issue asks for it.** hw-native-sys#163 proposes it "between `_create_runner` and
`init_kv_cache`", motivated by Qwen's `DistributedWorker` forking inside
`init_kv_cache` — so staging must happen before that. Checking the actual order in
`PyptoExecutor.register_model`, it already does: `_compile_model` runs first, and Qwen
stages inside it, well ahead of `_create_runner` and the fork. The constraint the hook
exists to satisfy is met without it.

That leaves the hook as an architectural tidy-up — separating "compile kernels" from
"stage weights" into named phases — and it would touch `common/runner/model_runner.py`
plus both `npu_runner.py`, which is exactly where the six open PRs are. Adding surface
to the most contested files in the repo to formalise a phase ordering that already holds
is a poor trade this week. Worth doing after they land, with the timing rationale
restated then rather than assumed.
lterrac added a commit to lterrac/pypto-serving that referenced this pull request Aug 21, 2026
files the rest of it would touch.

`RuntimeModel.layers` is now defaulted and empty for every loader in the tree, and
`LayerWeights` is documented as deprecated with a pointer to what replaced it. Both are
kept rather than deleted on purpose: hw-native-sys#168, hw-native-sys#114, hw-native-sys#152, hw-native-sys#145, hw-native-sys#144 and hw-native-sys#132 are open, and
some construct a `RuntimeModel`. Removing the field would break them for no gain that
cannot wait — it goes when they have landed.

`--num-layers-override` in the Qwen example loses its `runtime_model.layers[:n]` slice,
which had quietly become a no-op: staging reads `config.num_hidden_layers` and pulls
exactly that many layers from the checkpoint, so replacing the config *is* the override
now. The knob still works; there is simply nothing eager left to truncate.

**The `stage_weights` hook is deliberately not added, and the reason is worth recording
because the issue asks for it.** hw-native-sys#163 proposes it "between `_create_runner` and
`init_kv_cache`", motivated by Qwen's `DistributedWorker` forking inside
`init_kv_cache` — so staging must happen before that. Checking the actual order in
`PyptoExecutor.register_model`, it already does: `_compile_model` runs first, and Qwen
stages inside it, well ahead of `_create_runner` and the fork. The constraint the hook
exists to satisfy is met without it.

That leaves the hook as an architectural tidy-up — separating "compile kernels" from
"stage weights" into named phases — and it would touch `common/runner/model_runner.py`
plus both `npu_runner.py`, which is exactly where the six open PRs are. Adding surface
to the most contested files in the repo to formalise a phase ordering that already holds
is a poor trade this week. Worth doing after they land, with the timing rationale
restated then rather than assumed.
lterrac added a commit to lterrac/pypto-serving that referenced this pull request Aug 24, 2026
files the rest of it would touch.

`RuntimeModel.layers` is now defaulted and empty for every loader in the tree, and
`LayerWeights` is documented as deprecated with a pointer to what replaced it. Both are
kept rather than deleted on purpose: hw-native-sys#168, hw-native-sys#114, hw-native-sys#152, hw-native-sys#145, hw-native-sys#144 and hw-native-sys#132 are open, and
some construct a `RuntimeModel`. Removing the field would break them for no gain that
cannot wait — it goes when they have landed.

`--num-layers-override` in the Qwen example loses its `runtime_model.layers[:n]` slice,
which had quietly become a no-op: staging reads `config.num_hidden_layers` and pulls
exactly that many layers from the checkpoint, so replacing the config *is* the override
now. The knob still works; there is simply nothing eager left to truncate.

**The `stage_weights` hook is deliberately not added, and the reason is worth recording
because the issue asks for it.** hw-native-sys#163 proposes it "between `_create_runner` and
`init_kv_cache`", motivated by Qwen's `DistributedWorker` forking inside
`init_kv_cache` — so staging must happen before that. Checking the actual order in
`PyptoExecutor.register_model`, it already does: `_compile_model` runs first, and Qwen
stages inside it, well ahead of `_create_runner` and the fork. The constraint the hook
exists to satisfy is met without it.

That leaves the hook as an architectural tidy-up — separating "compile kernels" from
"stage weights" into named phases — and it would touch `common/runner/model_runner.py`
plus both `npu_runner.py`, which is exactly where the six open PRs are. Adding surface
to the most contested files in the repo to formalise a phase ordering that already holds
is a poor trade this week. Worth doing after they land, with the timing rationale
restated then rather than assumed.
lterrac added a commit to lterrac/pypto-serving that referenced this pull request Aug 25, 2026
files the rest of it would touch.

`RuntimeModel.layers` is now defaulted and empty for every loader in the tree, and
`LayerWeights` is documented as deprecated with a pointer to what replaced it. Both are
kept rather than deleted on purpose: hw-native-sys#168, hw-native-sys#114, hw-native-sys#152, hw-native-sys#145, hw-native-sys#144 and hw-native-sys#132 are open, and
some construct a `RuntimeModel`. Removing the field would break them for no gain that
cannot wait — it goes when they have landed.

`--num-layers-override` in the Qwen example loses its `runtime_model.layers[:n]` slice,
which had quietly become a no-op: staging reads `config.num_hidden_layers` and pulls
exactly that many layers from the checkpoint, so replacing the config *is* the override
now. The knob still works; there is simply nothing eager left to truncate.

**The `stage_weights` hook is deliberately not added, and the reason is worth recording
because the issue asks for it.** hw-native-sys#163 proposes it "between `_create_runner` and
`init_kv_cache`", motivated by Qwen's `DistributedWorker` forking inside
`init_kv_cache` — so staging must happen before that. Checking the actual order in
`PyptoExecutor.register_model`, it already does: `_compile_model` runs first, and Qwen
stages inside it, well ahead of `_create_runner` and the fork. The constraint the hook
exists to satisfy is met without it.

That leaves the hook as an architectural tidy-up — separating "compile kernels" from
"stage weights" into named phases — and it would touch `common/runner/model_runner.py`
plus both `npu_runner.py`, which is exactly where the six open PRs are. Adding surface
to the most contested files in the repo to formalise a phase ordering that already holds
is a poor trade this week. Worth doing after they land, with the timing rationale
restated then rather than assumed.
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.

1 participant