Diffusers documentation

IPNDMScheduler

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

IPNDMScheduler

IPNDMScheduler는 4차 Improved Pseudo Linear Multistep 스케줄러입니다. 원래 구현은 crowsonkb/v-diffusion-pytorch에서 확인할 수 있습니다.

IPNDMScheduler

클래스 diffusers.IPNDMScheduler

< >

( num_train_timesteps: int = 1000trained_betas: numpy.ndarray | list[float] | None = None )

매개변수

  • num_train_timesteps (int, 기본값 1000) — 모델을 학습할 때 사용할 diffusion 단계 수입니다.
  • trained_betas (np.ndarray 또는 List[float], 선택 사항) — beta_start와 beta_end를 우회하여 베타 배열을 생성자에 직접 전달합니다.

4차 개선된 의사 선형 다단계 스케줄러

이 모델은 SchedulerMixin과 ConfigMixin을 상속합니다. 로딩 및 저장과 같은 모든 스케줄러에 대해 라이브러리가 구현하는 일반적 메서드에 대해서는 상위 클래스 문서를 확인하세요.

index_for_timestep

< >

( timestep: typing.Union[float, torch.Tensor]schedule_timesteps: typing.Optional[torch.Tensor] = None ) → int

매개변수

  • timestep (float 또는 torch.Tensor) — 스케줄에서 찾을 timestep 값입니다.
  • schedule_timesteps (torch.Tensor, 선택 사항) — 검색할 timestep schedule입니다. None인 경우 self.timesteps를 사용합니다.

반환값

int

The index of the timestep in the schedule. For the very first step, returns the second index if multiple matches exist to avoid skipping a sigma when starting mid-schedule (e.g., for image-to-image).

…

scale_model_input

< >

( sample: Tensor*args**kwargs ) → torch.Tensor

매개변수

  • sample (torch.Tensor) — 입력 샘플입니다.

반환값

torch.Tensor

스케일된 입력 샘플.

현재 timestep에 따라 denoising 모델 입력을 scale해야 하는 scheduler와의 호환성을 보장합니다.

set_begin_index

< >

( begin_index: int = 0 )

매개변수

  • begin_index (int, 기본값 0) — 스케줄러의 시작 인덱스입니다.

… 스케줄러의 시작 인덱스를 설정합니다. 이 함수는 추론 전에 파이프라인에서 실행해야 합니다.

set_timesteps

< >

( num_inference_steps: intdevice: typing.Union[str, torch.device, NoneType] = None )

매개변수

  • num_inference_steps (int) — 학습된 모델로 샘플을 생성할 때 사용되는 diffusion 단계 수입니다.
  • device (str 또는 torch.device, 선택 사항) — timesteps를 이동할 대상 device입니다. None인 경우 timesteps는 이동되지 않습니다.

추론 실행 전에 실행할 diffusion chain에 사용할 이산 timesteps를 설정합니다.

단계

< >

( model_output: Tensortimestep: typing.Union[int, torch.Tensor]sample: Tensorreturn_dict: bool = True ) → SchedulerOutput or tuple

매개변수

  • model_output (torch.Tensor) — 학습된 diffusion 모델의 직접적인 출력입니다.
  • timestep (int 또는 torch.Tensor) — 확산 체인(diffusion chain)의 현재 이산 시간 단계(discrete timestep)입니다.
  • sample (torch.Tensor) — 확산 과정에 의해 생성된 샘플의 현재 인스턴스입니다.
  • return_dict (bool) — bool SchedulerOutput 또는 튜플을 반환할지 여부.

반환값

SchedulerOutput 또는 tuple

return_dict가 True인 경우 SchedulerOutput이 반환되고, 그렇지 않으면 첫 번째 요소가 샘플 텐서인 튜플이 반환됩니다.

이전 시간 단계의 샘플을 SDE를 역방향으로 적용하여 예측합니다. 이 함수는 선형 다단계 방법을 사용하여 샘플을 전파합니다. 해를 근사하기 위해 포워드 패스를 여러 번 수행합니다.

SchedulerOutput

class diffusers.schedulers.scheduling_utils.SchedulerOutput

< >

( prev_sample: Tensor )

매개변수

  • prev_sample (이미지의 경우 torch.Tensor, shape (batch_size, num_channels, height, width)) — 이전 timestep의 계산된 샘플 (x_{t-1}). prev_sample은 denoising 루프에서 다음 모델 입력으로 사용해야 합니다.

스케줄러의 step 함수 출력을 위한 베이스 클래스.

Update on GitHub