config: resolve the draft worker's config per runner, not on a copy
The v2 spec workers got a published `ServerArgs` copy carrying two values: the target's context length and `--speculative-draft-load-format`. Neither is a process-wide config change — each is consumed by exactly one constructor — so the copy, the publish switch around the draft build, and the replay of the target's resolved overrides onto it all go away, and the values travel to the runner that owns them: - **Context length.** `TpModelWorker` already takes it (`context_length=None` keeps `server_args.context_length`); the four v2 draft workers and `build_draft_tp_worker` pass the target's, which every one of them has in scope as `target_worker` / `target_model_config`. - **Load format.** `ModelRunner._draft_load_format()` resolves it for a draft runner and `build_load_config` takes it, so the `LoadConfig` is per-runner. Model code also reads it off the bag while it builds — Inkling replaces per-element noise in its shared-expert scales under dummy loading — so the load is wrapped in a scoped bag override that puts the target's value back. - `skip_tokenizer_init` was on the copy for nobody: `TpModelWorker` already short-circuits the tokenizer for a draft worker (`or self.is_draft_worker`). `PrefillCudaGraphRunner._max_addressable_prefix_len` capped the prefix by `server_args.context_length`, which the copy used to carry for the draft; it now reads the runner's own `model_config.context_len`. That is also more accurate for the target, whose `--context-length` may be unset while the resolved context is shorter than the token table. What stays a variant is the dflash/dspark path's attention backend: backend selection reads it off the config object the draft runner holds, and the resolved gate has to survive the variant's publish. `draft_server_args_overrides` now carries only those fields and says why.
This commit is contained in:
@@ -636,8 +636,13 @@ class _ConfigBag:
|
||||
|
||||
@contextmanager
|
||||
def override(self, **kwargs):
|
||||
"""Scoped, transactional test-only override of this bag's own leaves
|
||||
(keys validated before any write; restored on exit)."""
|
||||
"""Scoped, transactional override of this bag's own leaves (keys
|
||||
validated before any write; restored on exit).
|
||||
|
||||
For a window where one runner's value differs from the process's — a
|
||||
draft model loading under ``--speculative-draft-load-format`` while the
|
||||
target keeps ``--load-format`` — and for tests forcing a code path.
|
||||
A permanent change goes through ``get_context().override``."""
|
||||
fields = object.__getattribute__(self, "_fields")
|
||||
unknown = set(kwargs) - set(fields)
|
||||
if unknown:
|
||||
|
||||
Reference in New Issue
Block a user