def set_timesteps(
        self,
        num_inference_steps: int = None,
        device: Union[str, torch.device] = None,
        sigmas: Optional[Union[torch.Tensor, List[float]]] = None,
    ):
        """
        Sets the discrete timesteps used for the diffusion chain (to be run before inference).

        Args:
            num_inference_steps (`int`):
                The number of diffusion steps used when generating samples with a pre-trained model.
            device (`str` or `torch.device`, *optional*):
                The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
            sigmas (`Union[torch.Tensor, List[float]]`, *optional*):
                Custom sigmas to use for the denoising process. If not defined, the default behavior when
                `num_inference_steps` is passed will be used.
        """
        self.num_inference_steps = num_inference_steps

        sigmas_dtype = torch.float32 if torch.backends.mps.is_available() else torch.float64
        if sigmas is None:
            sigmas = torch.linspace(0, 1, self.num_inference_steps, dtype=sigmas_dtype)
        elif isinstance(sigmas, float):
            sigmas = torch.tensor(sigmas, dtype=sigmas_dtype)
        else:
            sigmas = sigmas.to(sigmas_dtype)
        if self.config.sigma_schedule == "karras":
            sigmas = self._compute_karras_sigmas(sigmas)
        elif self.config.sigma_schedule == "exponential":
            sigmas = self._compute_exponential_sigmas(sigmas)
        sigmas = sigmas.to(dtype=torch.float32, device=device)

        self.timesteps = self.precondition_noise(sigmas)

        if self.config.final_sigmas_type == "sigma_min":
            sigma_last = sigmas[-1]
        elif self.config.final_sigmas_type == "zero":
            sigma_last = 0
        else:
            raise ValueError(
                f"`final_sigmas_type` must be one of 'zero', or 'sigma_min', but got {self.config.final_sigmas_type}"
            )

        self.sigmas = torch.cat([sigmas, torch.full((1,), fill_value=sigma_last, device=sigmas.device)])
        self._step_index = None
        self._begin_index = None
        self.sigmas = self.sigmas.to("cpu")  # to avoid too much CPU/GPU communication

        Sets the discrete timesteps used for the diffusion chain (to be run before inference).

        Args:
            num_inference_steps (`int`):
                The number of diffusion steps used when generating samples with a pre-trained model.
            device (`str` or `torch.device`, *optional*):
                The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
            sigmas (`Union[torch.Tensor, List[float]]`, *optional*):
                Custom sigmas to use for the denoising process. If not defined, the default behavior when
                `num_inference_steps` is passed will be used.
        
src/diffusers/schedulers/scheduling_edm_euler.py