diff --git a/server/text_generation_server/utils/tokens.py b/server/text_generation_server/utils/tokens.py index 15563761..c7594644 100644 --- a/server/text_generation_server/utils/tokens.py +++ b/server/text_generation_server/utils/tokens.py @@ -75,7 +75,11 @@ class NextTokenChooser: def __call__(self, input_ids, scores): # Warp logits - scores = self.warpers(input_ids, scores) + if scores.shape[0] > 1: + # only warp the last token logits + scores[-1:, :] = self.warpers(input_ids, scores[-1:, :]) + else: + scores = self.warpers(input_ids, scores) # Compute logprobs logprobs = torch.log_softmax(scores, -1)