[core] remove beam search from the core (#9105)

This commit is contained in:
youkaichao
2024-10-07 05:47:04 +00:00
committed by GitHub
parent c8f26bb636
commit 18b296fdb2
25 changed files with 98 additions and 596 deletions
+1 -5
View File
@@ -142,11 +142,7 @@ class RequestOutput:
else:
# Get the top-n sequences.
n = sampling_params.n
if sampling_params.use_beam_search:
sorting_key = lambda seq: seq.get_beam_search_score(
sampling_params.length_penalty)
else:
sorting_key = lambda seq: seq.get_cumulative_logprob()
sorting_key = lambda seq: seq.get_cumulative_logprob()
sorted_seqs = sorted(seqs, key=sorting_key, reverse=True)
top_n_seqs = sorted_seqs[:n]