Skip to content

Commit

Permalink
fix crashing on cpu (#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
minhthuc2502 authored Oct 14, 2024
1 parent 087d085 commit c687308
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/decoding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,12 @@ namespace ctranslate2 {

disable_tokens.apply();
std::vector<StorageView> logits_vec;
if (return_logits_vocab)
logits_vec = build_logits(logits, cur_batch_size * _beam_size);
if (return_logits_vocab) {
if (is_expanded)
logits_vec = build_logits(logits, cur_batch_size * _beam_size);
else
logits_vec = build_logits(logits, cur_batch_size);
}

StorageView log_probs(dtype, device);
if (bias_towards_prefix) {
Expand Down

0 comments on commit c687308

Please sign in to comment.