Skip to content

Commit

Permalink
Model: Account for tokenizer lazy init
Browse files Browse the repository at this point in the history
  • Loading branch information
turboderp committed Aug 23, 2024
1 parent a676c4b commit fe3253f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backends/exllamav2/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ def get_special_tokens(
def get_logprobs(self, token_ids: torch.Tensor, token_probs: torch.Tensor):
top_tokens = [
self.tokenizer.extended_id_to_piece.get(
index, self.tokenizer.id_to_piece[index]
index, self.tokenizer.get_id_to_piece_list(True)[index]
)
for index in token_ids.flatten().tolist()
]
Expand Down Expand Up @@ -1146,7 +1146,7 @@ async def generate_gen(

# Map logits to the tensor with their biases
for token_id, bias in logit_bias.items():
if 0 <= token_id < len(self.tokenizer.id_to_piece):
if 0 <= token_id < len(self.tokenizer.get_id_to_piece_list(True)):
gen_settings.token_bias[token_id] = bias
else:
logger.warning(
Expand Down

0 comments on commit fe3253f

Please sign in to comment.