From 5e44ca8ba5c19260bf169b89b0147e429c9823ef Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Thu, 19 Dec 2024 13:41:16 +0100 Subject: [PATCH] Fixed segfault --- src/cpp/src/lm_encoding.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpp/src/lm_encoding.cpp b/src/cpp/src/lm_encoding.cpp index f030159511..4ba6d161a5 100644 --- a/src/cpp/src/lm_encoding.cpp +++ b/src/cpp/src/lm_encoding.cpp @@ -222,8 +222,8 @@ std::pair get_lm_encoded_results( const auto& sequences = request->get_finished_sequences(); size_t num_outputs = std::min(request->get_sampling_parameters().num_return_sequences, sequences.size()); - for (size_t generation_output_idx = 0; generation_output_idx < num_outputs; ++generation_output_idx) { - const auto & sequence = sequences[i]; + for (size_t seq_id = 0; seq_id < num_outputs; ++seq_id) { + const auto & sequence = sequences[seq_id]; const float score = sampling_params.is_beam_search() ? sequence->get_beam_search_score(sampling_params) : sequence->get_cumulative_log_probs(); results.tokens.push_back(sequence->get_generated_ids());