Spaces:
Paused
Paused
plop
Browse files95 unmodified lines969798991001011026 unmodified lines10911011111211311411511695 unmodified linesdef set_generation_params(self, use_sampling: bool = True, top_k: int = 250,top_p: float = 0.0, temperature: float = 1.0,duration: float = 30.0, cfg_coef: float = 3.0,two_step_cfg: bool = False):"""Set the generation parameters for MusicGen.Args:6 unmodified linestwo_step_cfg (bool, optional): If True, performs 2 forward for Classifier Free Guidance,instead of batching together the two. This has some impact on how thingsare padded but seems to have little impact in practice."""assert duration <= 30, "The MusicGen cannot generate more than 30 seconds"self.generation_params = {'max_gen_len': int(duration * self.frame_rate),'use_sampling': use_sampling,95 unmodified lines969798991001011026 unmodified lines10911011111211311411511611711811912012195 unmodified linesdef set_generation_params(self, use_sampling: bool = True, top_k: int = 250,top_p: float = 0.0, temperature: float = 1.0,duration: float = 30.0, cfg_coef: float = 3.0,two_step_cfg: bool = False, extend_stride: float = 15):"""Set the generation parameters for MusicGen.Args:6 unmodified linestwo_step_cfg (bool, optional): If True, performs 2 forward for Classifier Free Guidance,instead of batching together the two. This has some impact on how thingsare padded but seems to have little impact in practice.extend_stride: when doing extended generation (i.e. more than 30 seconds), by how muchshould we extend the audio each time. Larger values will mean less context ispreserved, and shorter value will require extra computations."""# assert duration <= 30, "The MusicGen cannot generate more than 30 seconds"assert extend_stride <= 25, "Keep at least 5 seconds of overlap!"self.extend_stride = extend_strideself.generation_params = {'max_gen_len': int(duration * self.frame_rate),'use_sampling': use_sampling,
audiocraft/models/musicgen.py+7-2