Untitled conversation
- User
@vectorized def loss(pop: torch.Tensor) -> torch.Tensor: pop_loss = [] styles = i2v(pop.to(tts.device)) # => [P, 510, 1, 256] N = max(1, args.batch // len(phonemes)) # max candidates per forward pass for styles in [styles[i : i + N] for i in range(0, styles.shape[0], N)]: n, _, _, _ = styles.shape styles = styles.repeat_interleave(len(phonemes), 0) # => [n, 510, 1, 256] with torch.autocast(tts.device.type): syn_wavs, syn_lens = tts.forward_batch(styles, phonemes * n, speed=1) pool, temp = mimi_loss(mimi, ref_wavs, ref_lens, syn_wavs, syn_lens, n) loss = pool + temp loss += 1e-2 * resemblyzer_loss(venc, ref_wavs, ref_lens, syn_wavs, syn_lens, n) if args.spectral: loss += 1e-5 + spectral_loss(ref_wavs, syn_wavs, n) pop_loss.append(1e2 * loss) pop_loss = torch.cat(pop_loss) if args.interp: # TODO: add a regularization term of distance to pack (for avoiding very OOD style tensor) # # the idea is to _prefer_ directions that are not OOD w.r.t. the available pretrained styles, but # still permit some variation. so it shouldn't overwhelm the existing pop_loss # # pop_loss = [P] # styles = [P, 510, 1, 256] # pack = [V, 510, 1, 256] # # basically i need to compute the mean mean-square-error between every style in styles with all # styles in pack. final shape should be [P], and added onto pop_loss pass return torch.nan_to_num(pop_loss, nan=math.inf)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.