Pass per-forward overrides to ForwardBatch.init_new as explicit arguments (#30670)
This commit is contained in:
@@ -507,7 +507,11 @@ def extend(reqs, model_runner):
|
||||
)
|
||||
batch.prefill_input_ids_cpu = None
|
||||
|
||||
forward_batch = ForwardBatch.init_new(batch, model_runner)
|
||||
forward_batch = ForwardBatch.init_new(
|
||||
batch,
|
||||
model_runner,
|
||||
return_hidden_states_before_norm=False,
|
||||
)
|
||||
logits_output = model_runner.forward(forward_batch).logits_output
|
||||
next_token_ids = model_runner.sample(logits_output, forward_batch)
|
||||
return next_token_ids, logits_output.next_token_logits, batch
|
||||
@@ -518,7 +522,11 @@ def decode(input_token_ids, batch, model_runner):
|
||||
batch.input_ids = input_token_ids.to(torch.int64)
|
||||
batch.prepare_for_decode()
|
||||
_maybe_prepare_mlp_sync_batch(batch, model_runner)
|
||||
forward_batch = ForwardBatch.init_new(batch, model_runner)
|
||||
forward_batch = ForwardBatch.init_new(
|
||||
batch,
|
||||
model_runner,
|
||||
return_hidden_states_before_norm=False,
|
||||
)
|
||||
logits_output = model_runner.forward(forward_batch).logits_output
|
||||
next_token_ids = model_runner.sample(logits_output, forward_batch)
|
||||
return next_token_ids, logits_output.next_token_logits
|
||||
|
||||
Reference in New Issue
Block a user