mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-10-07 15:19:59 +08:00
Update utils.py
now we can control the proportion
This commit is contained in:
parent
db120aebc9
commit
c52e080403
@ -208,17 +208,17 @@ def make_reject_y(y_o, y_lens):
|
||||
bs = len(y_lens)
|
||||
reject_y = []
|
||||
reject_y_lens = []
|
||||
process_item_idx = True
|
||||
proportion=0.5 # repeat/total
|
||||
for b in range(bs):
|
||||
if process_item_idx == True:
|
||||
process_item_idx = torch.rand(1)
|
||||
if process_item_idx < proportion:
|
||||
new_y = repeat_P(y_o[b])
|
||||
reject_y.append(new_y)
|
||||
reject_y_lens.append(len(new_y))
|
||||
elif process_item_idx == False:
|
||||
else:
|
||||
new_y = lost_P(y_o[b])
|
||||
reject_y.append(new_y)
|
||||
reject_y_lens.append(len(new_y))
|
||||
process_item_idx = not process_item_idx
|
||||
max_length = max(reject_y_lens)
|
||||
for b in range(bs):
|
||||
pad_length = max_length - reject_y_lens[b]
|
||||
|
Loading…
x
Reference in New Issue
Block a user