Buckets:
| # KDPM2DiscreteScheduler | |
| The `KDPM2DiscreteScheduler` is inspired by the [Elucidating the Design Space of Diffusion-Based Generative Models](https://huggingface.co/papers/2206.00364) paper, and the scheduler is ported from and created by [Katherine Crowson](https://github.com/crowsonkb/). | |
| 원본 코드베이스는 [crowsonkb/k-diffusion](https://github.com/crowsonkb/k-diffusion)에서 찾을 수 있습니다. | |
| ## KDPM2DiscreteScheduler[[diffusers.KDPM2DiscreteScheduler]] | |
| #### diffusers.KDPM2DiscreteScheduler[[diffusers.KDPM2DiscreteScheduler]] | |
| ```python | |
| diffusers.KDPM2DiscreteScheduler(num_train_timesteps: int = 1000, beta_start: float = 0.00085, beta_end: float = 0.012, beta_schedule: str = 'linear', trained_betas: numpy.ndarray | list[float] | None = None, use_karras_sigmas: bool = False, use_exponential_sigmas: bool = False, use_beta_sigmas: bool = False, prediction_type: str = 'epsilon', timestep_spacing: str = 'linspace', steps_offset: int = 0) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L103) | |
| **매개변수:** | |
| num_train_timesteps (`int`, 기본값 `1000`) : 모델을 학습하기 위한 diffusion step 수입니다. | |
| beta_start (`float`, 기본값 `0.00085`) : 추론의 시작 `beta` 값입니다. | |
| beta_end (`float`, 기본값 `0.012`) : 최종 `beta` 값. | |
| beta_schedule (`str`, 기본값 `"linear"`) : 베타 스케줄입니다. 베타 범위를 모델의 스테핑에 사용할 베타 시퀀스로 매핑합니다. `linear` 또는 `scaled_linear` 중 하나를 선택합니다. | |
| trained_betas (`np.ndarray` 또는 `list[float]`, *선택 사항*) : `beta_start`와 `beta_end`를 우회하여 베타 배열을 생성자에 직접 전달합니다. | |
| use_karras_sigmas (`bool`, 기본값 `False`) : 샘플링 과정에서 노이즈 스케줄의 단계 크기에 Karras sigmas를 사용할지 여부입니다. `True`인 경우, sigmas는 노이즈 레벨 {σi}의 시퀀스에 따라 결정됩니다. | |
| use_exponential_sigmas (`bool`, 기본값 `False`) : 샘플링 과정에서 노이즈 스케줄의 스텝 크기에 지수 시그마를 사용할지 여부. | |
| use_beta_sigmas (`bool`, defaults to `False`) : Whether to use beta sigmas for step sizes in the noise schedule during the sampling process. Refer to [Beta Sampling is All You Need](https://huggingface.co/papers/2407.12173) for more information. | |
| prediction_type (`str`, defaults to `"epsilon"`) : Prediction type of the scheduler function; can be `epsilon` (predicts the noise of the diffusion process), `sample` (directly predicts the noisy sample`) or `v_prediction` (see section 2.4 of [Imagen Video](https://huggingface.co/papers/2210.02303) paper). | |
| timestep_spacing (`str`, 기본값 `"linspace"`) : 타임스텝을 스케일링하는 방식입니다. 자세한 내용은 [일반적인 확산 노이즈 스케줄 및 샘플 스텝은 결함이 있습니다](https://huggingface.co/papers/2305.08891)의 표 2를 참조하세요. | |
| steps_offset (`int`, 기본값 `0`) : 일부 모델 계열에서 요구하는 추론 단계에 추가되는 오프셋입니다. | |
| KDPM2DiscreteScheduler is inspired by the DPMSolver2 and Algorithm 2 from the [Elucidating the Design Space of Diffusion-Based Generative Models](https://huggingface.co/papers/2206.00364) paper. | |
| 이 모델은 [SchedulerMixin](/docs/diffusers/main/ko/api/schedulers/overview#diffusers.SchedulerMixin)과 [ConfigMixin](/docs/diffusers/main/ko/api/configuration#diffusers.ConfigMixin)을 상속합니다. 로딩 및 저장과 같은 모든 스케줄러에 대해 라이브러리가 구현하는 일반적 메서드에 대해서는 상위 클래스 문서를 확인하세요. | |
| #### add_noise[[diffusers.KDPM2DiscreteScheduler.add_noise]] | |
| ```python | |
| add_noise(original_samples: Tensor, noise: Tensor, timesteps: Tensor) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L666) | |
| **매개변수:** | |
| original_samples (`torch.Tensor`) : 노이즈가 추가될 원래 샘플. | |
| noise (`torch.Tensor`) : 원래 샘플에 추가할 노이즈 텐서. | |
| timesteps (`torch.Tensor`) : 노이즈를 추가할 타임스텝으로, 스케줄에서 노이즈 레벨을 결정합니다. | |
| **반환값:** `torch.Tensor` | |
| timestep 스케줄에 따라 노이즈가 스케일링되어 추가된 노이즈 샘플. | |
| 지정된 timesteps의 noise schedule에 따라 원래 샘플에 노이즈를 추가합니다. | |
| #### index_for_timestep[[diffusers.KDPM2DiscreteScheduler.index_for_timestep]] | |
| ```python | |
| index_for_timestep(timestep: typing.Union[float, torch.Tensor], schedule_timesteps: typing.Optional[torch.Tensor] = None) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L365) | |
| **매개변수:** | |
| timestep (`float` 또는 `torch.Tensor`) : 스케줄에서 찾을 타임스텝 값. | |
| schedule_timesteps (`torch.Tensor`, *선택 사항*) : 검색할 timestep schedule입니다. `None`인 경우 `self.timesteps`를 사용합니다. | |
| **반환값:** `int` | |
| 스케줄에서 timestep의 인덱스입니다. 가장 첫 번째 단계의 경우, 스케줄 중간에서 시작할 때(예: image-to-image) sigma를 건너뛰지 않도록 여러 매치가 존재하면 두 번째 인덱스를 반환합니다. | |
| … | |
| #### scale_model_input[[diffusers.KDPM2DiscreteScheduler.scale_model_input]] | |
| ```python | |
| scale_model_input(sample: Tensor, timestep: typing.Union[float, torch.Tensor]) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L236) | |
| **매개변수:** | |
| sample (`torch.Tensor`) : 입력 샘플. | |
| timestep (`float` 또는 `torch.Tensor`) : diffusion chain의 현재 timestep. | |
| **반환값:** `torch.Tensor` | |
| 스케일된 입력 샘플. | |
| 현재 타임스텝에 따라 디노이징 모델 입력을 스케일링해야 하는 스케줄러와의 호환성을 보장합니다. | |
| #### set_begin_index[[diffusers.KDPM2DiscreteScheduler.set_begin_index]] | |
| ```python | |
| set_begin_index(begin_index: int = 0) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L226) | |
| **매개변수:** | |
| begin_index (`int`, 기본값 `0`) : 스케줄러의 시작 인덱스입니다. | |
| … 스케줄러의 시작 인덱스를 설정합니다. 이 함수는 추론 전에 파이프라인에서 실행해야 합니다. | |
| #### set_timesteps[[diffusers.KDPM2DiscreteScheduler.set_timesteps]] | |
| ```python | |
| set_timesteps(num_inference_steps: int, device: typing.Union[str, torch.device, NoneType] = None, num_train_timesteps: int | None = None) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L266) | |
| **매개변수:** | |
| num_inference_steps (`int`) : 사전 학습된 모델로 샘플을 생성할 때 사용되는 확산 단계의 수. | |
| device (`str` 또는 `torch.device`, *선택 사항*) : timesteps를 이동할 대상 device입니다. `None`인 경우 timesteps는 이동되지 않습니다. | |
| num_train_timesteps (`int`, *선택 사항*) : 모델을 학습하는 데 사용되는 확산 단계 수입니다. `None`인 경우 `self.config.num_train_timesteps`이 사용됩니다. | |
| 추론 실행 전에 실행할 diffusion chain에 사용할 이산 timesteps를 설정합니다. | |
| #### step[[diffusers.KDPM2DiscreteScheduler.step]] | |
| ```python | |
| step(model_output: typing.Union[torch.Tensor, numpy.ndarray], timestep: typing.Union[float, torch.Tensor], sample: typing.Union[torch.Tensor, numpy.ndarray], return_dict: bool = True) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L570) | |
| **매개변수:** | |
| model_output (`torch.Tensor` 또는 `np.ndarray`) : 학습된 diffusion model의 직접적인 출력입니다. | |
| timestep (`float` 또는 `torch.Tensor`) : 확산 체인(diffusion chain)의 현재 이산 시간 단계(discrete timestep). | |
| sample (`torch.Tensor` 또는 `np.ndarray`) : 확산 과정에서 생성된 샘플의 현재 인스턴스. | |
| return_dict (`bool`, 기본값 `True`) : `KDPM2DiscreteSchedulerOutput` 또는 tuple을 반환할지 여부. | |
| **반환값:** | |
| `KDPM2DiscreteSchedulerOutput` 또는 `tuple[torch.Tensor, torch.Tensor]`: `True`인 경우 `KDPM2DiscreteSchedulerOutput`를 반환하고, 그렇지 않으면 첫 번째 요소가 샘플 텐서인 튜플을 반환합니다. | |
| 이전 시간 단계의 샘플을 SDE를 역방향으로 적용하여 예측합니다. 이 함수는 학습된 모델의 출력(대부분 예측된 노이즈)으로부터 확산 과정을 전파합니다. | |
| ## SchedulerOutput[[diffusers.schedulers.scheduling_utils.SchedulerOutput]] | |
| #### diffusers.schedulers.scheduling_utils.SchedulerOutput[[diffusers.schedulers.scheduling_utils.SchedulerOutput]] | |
| ```python | |
| diffusers.schedulers.scheduling_utils.SchedulerOutput(prev_sample: Tensor) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_utils.py#L66) | |
| **매개변수:** | |
| prev_sample (`torch.Tensor`, 이미지인 경우 shape는 `(batch_size, num_channels, height, width)`) : 이전 timestep의 계산된 샘플 `(x_{t-1})`. `prev_sample`은 denoising 루프에서 다음 모델 입력으로 사용해야 합니다. | |
| 스케줄러의 `step` 함수 출력을 위한 베이스 클래스. | |
Xet Storage Details
- Size:
- 9.42 kB
- Xet hash:
- e7df37a764253cfc2fb8314d216e0507925c0123fc8b07c2bb6f2a45ea1b84f7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.