Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions torchchat/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,11 @@ def forward(self, x, input_pos):
# the first element to get the tensor
assert len(logits) == 1
logits = logits[0]

# Add a batch dimension, if it's missing (e.g. some pte's
# exported from the ExecuTorch repo)
if logits.dim() == 2:
logits = logits.unsqueeze(0)
return logits

def setup_caches(self, max_batch_size, max_seq_length):
Expand Down
Loading