Skip to content

Commit baa20b9

Browse files
committed
debug messages
1 parent d5d381f commit baa20b9

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

guidance/models/_llama_cpp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ def get_logits(self, token_ids: list[int], include_all_uncached_tokens: bool = F
215215
logits_for_each_batch,
216216
axis=0
217217
)
218-
assert logits.shape[0] == len(token_ids) - num_cached
218+
assert logits.shape[0] == len(token_ids) - num_cached, (
219+
f"Expected {len(token_ids) - num_cached} logits, got {logits.shape[0]}."
220+
f"\nEach batch had shape {', '.join(str(x.shape) for x in logits_for_each_batch)}."
221+
f"\n{num_cached=}, {len(token_ids)=}, {n_batch=}"
222+
)
219223
return logits
220224
else:
221225
return self._cached_logits

guidance/models/_transformers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,11 @@ def get_logits(self, token_ids: list[int], include_all_uncached_tokens: bool = F
635635
logits_for_each_batch,
636636
axis=0
637637
)
638-
assert logits.shape[0] == len(token_ids) - num_cached
638+
assert logits.shape[0] == len(token_ids) - num_cached, (
639+
f"Expected {len(token_ids) - num_cached} logits, got {logits.shape[0]}."
640+
f"\nEach batch had shape {', '.join(str(x.shape) for x in logits_for_each_batch)}."
641+
f"\n{num_cached=}, {len(token_ids)=}, {len(new_token_ids)=}"
642+
)
639643
return logits
640644
else:
641645
return self._cached_logits

0 commit comments

Comments
 (0)