code: def betas_for_alpha_bar(num_diffusion_timesteps, max_beta=0.999):
      """
      Create a beta schedule that discretizes the given alpha_t_bar function, which defines the cumulative product of
      (1-beta) over time from t = [0,1].
  
      :param num_diffusion_timesteps: the number of betas to produce. :param alpha_bar: a lambda that takes an argument t
      from 0 to 1 and
                        produces the cumulative product of (1-beta) up to that part of the diffusion process.
      :param max_beta: the maximum beta to use; use values lower than 1 to
                       prevent singularities.
      """
  
      def alpha_bar(time_step):
          return (
              math.cos((time_step + 0.008) / 1.008 * math.pi / 2) ** 2
          )
  
      betas = []
      for i in range(num_diffusion_timesteps):
          t1 = i / num_diffusion_timesteps
          t2 = (i + 1) / num_diffusion_timesteps
          betas.append(min(1 - alpha_bar(t2) / alpha_bar(t1), max_beta))
      return np.array(betas, dtype=np.float32)
  
file_path: PaddleHub/modules/image/text_to_image/stable_diffusion/diffusers/schedulers/scheduling_pndm.py
imports: import math
  from typing import Union
  import numpy
  import paddle
  from ..configuration_utils import ConfigMixin
  from ..configuration_utils import register_to_config
  from .scheduling_utils import SchedulerMixin
label_desc: Use image node_id 1 for calling a global function with example usage: betas_for_alpha_bar(num_diffusion_timesteps, max_beta) and returns: np, unknown