code: def get_named_beta_schedule(schedule_name, num_diffusion_timesteps):
      """
      Get a pre-defined beta schedule for the given name.
  
      The beta schedule library consists of beta schedules which remain similar
      in the limit of num_diffusion_timesteps.
      Beta schedules may be added, but should not be removed or changed once
      they are committed to maintain backwards compatibility.
      """
      if schedule_name == "linear":
          # Linear schedule from Ho et al, extended to work for any number of
          # diffusion steps.
          scale = 1000 / num_diffusion_timesteps
          beta_start = scale * 0.0001
          beta_end = scale * 0.02
          return np.linspace(
              beta_start,
              beta_end,
              num_diffusion_timesteps,
              dtype=np.float64,
          )
      elif schedule_name == "cosine":
          return betas_for_alpha_bar(
              num_diffusion_timesteps,
              lambda t: math.cos((t + 0.008) / 1.008 * math.pi / 2)
              ** 2,
          )
      else:
          raise NotImplementedError(
              f"unknown beta schedule: {schedule_name}"
          )
  
imports: import enum
  import math
  import numpy
  import torch
  import torch
  from tqdm import tqdm
  from TTS.tts.layers.tortoise.dpm_solver import DPM_Solver, NoiseScheduleVP, model_wrapper
label_desc: Use image node_id 5 for calling a global function with example usage: get_named_beta_schedule(schedule_name, num_diffusion_timesteps) and returns: np, betas_for_alpha_bar