Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
aluminumbox committed Dec 30, 2024
1 parent b9ddcba commit d3b1a8e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cosyvoice/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,14 @@ def sampling_ids(
sampling: int,
ignore_eos: bool = True,
):
num_trials, max_trials = 0, 100
while True:
top_ids = self.sampling(weighted_scores, decoded_tokens, sampling)
if (not ignore_eos) or (self.speech_token_size not in top_ids):
break
num_trials += 1
if num_trials > max_trials:
raise RuntimeError('sampling reaches max_trials {} and still get eos when ignore_eos is True, check your input!'.format(max_trials))
return top_ids

@torch.inference_mode()
Expand Down

0 comments on commit d3b1a8e

Please sign in to comment.