Skip to content

Commit a99bdbe

Browse files
authored
Merge pull request #5 from fjfricke/inline_probabilities
bugfix for openai
2 parents 9df6372 + 80d9bd6 commit a99bdbe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lmql/runtime/dclib/dclib_seq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def make_successors(self, next_tokens, next_token_scores, logits, user_data=None
441441
tokens = [t for t, s in zip(next_tokens, next_token_scores) if s > get_truncation_threshold()]
442442
scores = [s for s in next_token_scores if s > get_truncation_threshold()]
443443

444-
distribution_logprobs = [{get_tokenizer().decode([k]): v for k, v in logits.probs.items() if type(k) == int and v > -10}]
444+
distribution_logprobs = [{get_tokenizer().decode([k]) if isinstance(k, int) else k: v for k, v in logits.probs.items() if v > -10}]
445445
if len(distribution_logprobs[0]) < 1:
446446
distribution_logprobs = None
447447

0 commit comments

Comments
 (0)