fix long prompt generations (#1023)

This commit is contained in:
Awni Hannun 2024-10-09 11:09:36 -07:00 committed by GitHub
parent fca087be49
commit b7373cb44f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -239,8 +239,8 @@ def generate_step(
return y, logprobs.squeeze(0) return y, logprobs.squeeze(0)
while y.size > prefill_step_size: while y.size > prefill_step_size:
model(y[:prefill_step_size][None], cache=cache) model(y[:prefill_step_size][None], cache=prompt_cache)
mx.eval([c.state for c in cache]) mx.eval([c.state for c in prompt_cache])
y = y[prefill_step_size:] y = y[prefill_step_size:]
y, logprobs = _step(y) y, logprobs = _step(y)