mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-29 18:26:37 +08:00
put prompt processing in same stream
This commit is contained in:
parent
adaab81029
commit
3586c876aa
@ -274,13 +274,14 @@ def generate_step(
|
|||||||
y = sampler(logprobs)
|
y = sampler(logprobs)
|
||||||
return y, logprobs.squeeze(0)
|
return y, logprobs.squeeze(0)
|
||||||
|
|
||||||
while y.size > prefill_step_size:
|
with mx.stream(generation_stream):
|
||||||
model(y[:prefill_step_size][None], cache=prompt_cache)
|
while y.size > prefill_step_size:
|
||||||
mx.eval([c.state for c in prompt_cache])
|
model(y[:prefill_step_size][None], cache=prompt_cache)
|
||||||
y = y[prefill_step_size:]
|
mx.eval([c.state for c in prompt_cache])
|
||||||
mx.metal.clear_cache()
|
y = y[prefill_step_size:]
|
||||||
|
mx.metal.clear_cache()
|
||||||
|
|
||||||
y, logprobs = _step(y)
|
y, logprobs = _step(y)
|
||||||
|
|
||||||
mx.async_eval(y, logprobs)
|
mx.async_eval(y, logprobs)
|
||||||
n = 0
|
n = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user