[Fix] NGRAMWorker.update_weights_from_tensor — delegate to target worker (#24344)

This commit is contained in:
Ji Zeng
2026-05-04 16:23:17 -07:00
committed by GitHub
parent 6a62eabed6
commit 4b487ca98b
@@ -83,6 +83,15 @@ class NGRAMWorker:
def clear_cache_pool(self):
self.ngram_corpus.reset()
def update_weights_from_tensor(self, recv_req):
# NGRAM has no draft weights of its own — the n-gram corpus is a CPU
# lookup structure built from request token streams — and its
# `model_runner` is shared with the target worker. The scheduler
# mixin dispatches via `self.draft_worker or self.tp_worker`, so
# without this method any caller of `update_weights_from_tensor`
# under `--speculative-algorithm NGRAM` raises AttributeError.
return self.target_worker.update_weights_from_tensor(recv_req)
def add_external_corpus(self, corpus_id: str, token_chunks: list[list[int]]) -> int:
return self.ngram_corpus.load_external_corpus_named(corpus_id, token_chunks)