Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warmup when using spculative decoding #402

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions server/lorax_server/models/flash_causal_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,11 +763,15 @@ def warmup(self, batch: FlashCausalLMBatch, max_new_tokens: int):
)

with warmup_mode():
logger.info("Warming up to max_total_tokens: {}", max_new_tokens)
logger.info("Warming up to max_new_tokens: {}", max_new_tokens)
with tqdm(total=max_new_tokens, desc="Warmup to max_total_tokens") as pbar:
for _ in range(max_new_tokens):
cur_seqlen = batch.max_seqlen
_, batch = self.generate_token(batch, is_warmup=True)
pbar.update(1)
new_seqlen = batch.max_seqlen
pbar.update(new_seqlen - cur_seqlen)
if new_seqlen >= max_total_tokens:
break
logger.info("Finished generating warmup tokens")
except RuntimeError as e:
if "CUDA out of memory" in str(e) or isinstance(e, torch.cuda.OutOfMemoryError):
Expand Down
Loading