espnet2.tts.prodiff.denoiser.noise_scheduler
Less than 1 minute
espnet2.tts.prodiff.denoiser.noise_scheduler
espnet2.tts.prodiff.denoiser.noise_scheduler(sched_type: str, timesteps: int, min_beta: float = 0.0, max_beta: float = 0.01, s: float = 0.008) → Tensor
Noise Scheduler.
This function generates a noise schedule based on the specified type of scheduler. The noise schedule can be linear, cosine, or vpsde, and it returns a tensor representing the noise values at each time step.
- Parameters:
- sched_type (str) – Type of scheduler. Options are “linear”, “cosine”, and “vpsde”.
- timesteps (int) – Number of time steps.
- min_beta (float , optional) – Minimum beta. Defaults to 0.0.
- max_beta (float , optional) – Maximum beta. Defaults to 0.01.
- s (float , optional) – Scheduler intersection. Defaults to 0.008.
- Returns: Tensor containing noise values for each time step.
- Return type: torch.Tensor
- Raises:NotImplementedError – If an unsupported scheduler type is provided.
Examples
>>> noise = noise_scheduler("linear", 100)
>>> print(noise.shape)
torch.Size([100])
>>> noise = noise_scheduler("cosine", 100)
>>> print(noise.shape)
torch.Size([100])
>>> noise = noise_scheduler("vpsde", 100, min_beta=0.1, max_beta=0.2)
>>> print(noise.shape)
torch.Size([100])