lyuxiang.lx 2 ay önce
ebeveyn
işleme
f2ddcbe7f9
1 değiştirilmiş dosya ile 1 ekleme ve 0 silme
  1. 1 0
      cosyvoice/utils/common.py

+ 1 - 0
cosyvoice/utils/common.py

@@ -139,6 +139,7 @@ def ras_sampling(weighted_scores, decoded_tokens, sampling, top_p=0.8, top_k=25,
     top_ids = nucleus_sampling(weighted_scores, top_p=top_p, top_k=top_k)
     rep_num = (torch.tensor(decoded_tokens[-win_size:]).to(weighted_scores.device) == top_ids).sum().item()
     if rep_num >= win_size * tau_r:
+        weighted_scores[top_ids] = -float('inf')
         top_ids = random_sampling(weighted_scores, decoded_tokens, sampling)
     return top_ids