Diffusers documentation

FlowMatchHeunDiscreteScheduler

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

FlowMatchHeunDiscreteScheduler

FlowMatchHeunDiscreteScheduler는 EDM에서 소개된 flow-matching 샘플링을 기반으로 합니다.

FlowMatchHeunDiscreteScheduler

클래스 diffusers.FlowMatchHeunDiscreteScheduler

< >

( num_train_timesteps: int = 1000shift: float = 1.0 )

매개변수

  • num_train_timesteps (int, 기본값 1000) — 모델을 학습할 때 사용할 diffusion 단계 수입니다.
  • shift (float, 기본값 1.0) — 타임스텝 스케줄에 사용할 shift 값입니다.

Heun 스케줄러.

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

index_for_timestep

< >

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

매개변수

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

반환값

int

schedule에서 timestep의 인덱스입니다.

…

scale_noise

< >

( sample: FloatTensortimestep: typing.Union[float, torch.FloatTensor]noise: FloatTensor ) → torch.FloatTensor

매개변수

  • sample (torch.FloatTensor) — 입력 샘플입니다.
  • timestep (float 또는 torch.FloatTensor) — 확산 체인(diffusion chain)의 현재 timestep입니다.
  • noise (torch.FloatTensor) — 노이즈 텐서입니다.

반환값

torch.FloatTensor

스케일된 입력 샘플.

Flow-matching의 forward process

set_begin_index

< >

( begin_index: int = 0 )

매개변수

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

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

set_timesteps

< >

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

매개변수

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

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

단계

< >

( model_output: FloatTensortimestep: typing.Union[float, torch.FloatTensor]sample: FloatTensors_churn: float = 0.0s_tmin: float = 0.0s_tmax: float = infs_noise: float = 1.0generator: typing.Optional[torch.Generator] = Nonereturn_dict: bool = True ) → FlowMatchHeunDiscreteSchedulerOutput or tuple

매개변수

  • model_output (torch.FloatTensor) — 학습된 diffusion 모델의 직접적인 출력입니다.
  • timestep (float 또는 torch.FloatTensor) — 확산 체인(diffusion chain)의 현재 이산 시간 단계(discrete timestep)입니다.
  • sample (torch.FloatTensor) — 확산 과정에 의해 생성된 샘플의 현재 인스턴스입니다.
  • s_churn (float) — 샘플링 중에 추가되는 노이즈의 양을 제어하는 확률성 파라미터입니다. 값이 높을수록 무작위성이 증가합니다.
  • s_tmin (float) — 확률성을 적용하기 위한 최소 타임스텝 임계값입니다. 이 값보다 큰 타임스텝에만 노이즈가 추가됩니다.
  • s_tmax (float) — 확률성을 적용하기 위한 최대 타임스텝 임계값입니다. 이 값보다 작은 타임스텝에만 노이즈가 추가됩니다.
  • s_noise (float, 기본값 1.0) — 샘플에 추가되는 노이즈의 스케일링 계수.
  • generator (torch.Generator, 선택 사항) — 난수 생성기입니다.
  • return_dict (bool) — FlowMatchHeunDiscreteSchedulerOutput 튜플을 반환할지 여부.

반환값

FlowMatchHeunDiscreteSchedulerOutput 또는 tuple

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

이전 시간 단계의 샘플을 SDE를 역방향으로 적용하여 예측합니다. 이 함수는 학습된 모델의 출력(대부분 예측된 노이즈)으로부터 확산 과정을 전파합니다.

Update on GitHub