Skip to content

Commit 45842ad

Browse files
tjohnson31415njhill
authored andcommitted
refactor: increase scope of try block
Signed-off-by: Travis Johnson <[email protected]>
1 parent 7ad221f commit 45842ad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

server/text_generation_server/models/causal_lm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,12 @@ def generate_token(
667667
logprobs,
668668
all_input_ids,
669669
) in enumerate(iterator):
670-
# Ensure tok view is 1st order, everything else is second.
671-
tok_view = next_token.view(-1)
672-
scores_view = scores.view(-1, scores.shape[-1])
673-
logprobs_view = logprobs.view(-1, logprobs.shape[-1]) if request.details.logprobs else None
674-
675670
try:
671+
# Ensure tok view is 1st order, everything else is second.
672+
tok_view = next_token.view(-1)
673+
scores_view = scores.view(-1, scores.shape[-1])
674+
logprobs_view = logprobs.view(-1, logprobs.shape[-1]) if request.details.logprobs else None
675+
676676
# TODO would be best to vectorize this also
677677
token_info = get_token_info(request, scores_view, tok_view, logprobs_view)
678678

0 commit comments

Comments
 (0)