# HeliosScheduler

`HeliosScheduler` é baseado no amostramento de fluxo-piramidal introduzido em [Helios](https://huggingface.co/papers).

## HeliosScheduler[[diffusers.HeliosScheduler]]

#### diffusers.HeliosScheduler[[diffusers.HeliosScheduler]]

```python
diffusers.HeliosScheduler(num_train_timesteps: int = 1000, shift: float = 1.0, stages: int = 3, stage_range: list = [0, 0.3333333333333333, 0.6666666666666666, 1], gamma: float = 0.3333333333333333, thresholding: bool = False, prediction_type: str = 'flow_prediction', solver_order: int = 2, predict_x0: bool = True, solver_type: str = 'bh2', lower_order_final: bool = True, disable_corrector: list[int] = [], solver_p: SchedulerMixin = None, use_flow_sigmas: bool = True, scheduler_type: str = 'unipc', use_dynamic_shifting: bool = False, time_shift_type: typing.Literal['exponential', 'linear'] = 'exponential')
```

[Fonte](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_helios.py#L35)

#### convert_model_output[[diffusers.HeliosScheduler.convert_model_output]]

```python
convert_model_output(model_output: Tensor, *args, sample: Tensor = None, sigma: Tensor = None, **kwargs)
```

[Fonte](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_helios.py#L371)

**Parâmetros:**

model_output (`torch.Tensor`) : A saída direta do modelo de difusão aprendido.

timestep (`int`) : O passo de tempo discreto atual na cadeia de difusão.

sample (`torch.Tensor`) : Uma instância atual de uma amostra criada pelo processo de difusão.

sigma (`torch.Tensor`, *opcional*) : O sigma da etapa atual no agendamento de ruído.

**Retorna:** `torch.Tensor`

A saída do modelo convertido.

Converta a saída do modelo para o tipo correspondente necessário pelo algoritmo UniPC.

#### init_sigmas[[diffusers.HeliosScheduler.init_sigmas]]

```python
init_sigmas()
```

[Fonte](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_helios.py#L90)

inicializar os timesteps e sigmas globais

#### init_sigmas_for_each_stage[[diffusers.HeliosScheduler.init_sigmas_for_each_stage]]

```python
init_sigmas_for_each_stage()
```

[Fonte](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_helios.py#L108)

Inicialize os timesteps para cada etapa

#### multistep_uni_c_bh_update[[diffusers.HeliosScheduler.multistep_uni_c_bh_update]]

```python
multistep_uni_c_bh_update(this_model_output: Tensor, *args, last_sample: Tensor = None, this_sample: Tensor = None, order: int = None, sigma_before: Tensor = None, sigma: Tensor = None, **kwargs)
```

[Fonte](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_helios.py#L591)

**Parâmetros:**

this_model_output (`torch.Tensor`) : As saídas do modelo em `x_t`.

this_timestep (`int`) : O timestep atual `t`.

last_sample (`torch.Tensor`) : A amostra gerada antes do último preditor `x_{t-1}`.

this_sample (`torch.Tensor`) : A amostra gerada após o último preditor `x_{t}`.

order (`int`) : O `p` do UniC-p nesta etapa. A ordem de precisão efetiva deve ser `order + 1`.

sigma_before (`torch.Tensor`, *opcional*) : O sigma da etapa anterior no cronograma de ruído.

sigma (`torch.Tensor`, *opcional*) : O sigma da etapa atual no agendamento de ruído.

**Retorna:** `torch.Tensor`

O tensor de amostra corrigido no timestep atual.

Um passo para o UniC (versão B(h)).

#### multistep_uni_p_bh_update[[diffusers.HeliosScheduler.multistep_uni_p_bh_update]]

```python
multistep_uni_p_bh_update(model_output: Tensor, *args, sample: Tensor = None, order: int = None, sigma: Tensor = None, sigma_next: Tensor = None, **kwargs)
```

[Fonte](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_helios.py#L453)

**Parâmetros:**

model_output (`torch.Tensor`) : A saída direta do modelo de difusão aprendido no timestep atual.

prev_timestep (`int`) : O passo de tempo discreto anterior na cadeia de difusão.

sample (`torch.Tensor`) : Uma instância atual de uma amostra criada pelo processo de difusão.

order (`int`) : A ordem do UniP neste timestep (corresponde ao *p* em UniPC-p).

sigma (`torch.Tensor`, *opcional*) : O sigma da etapa atual no agendamento de ruído.

sigma_next (`torch.Tensor`, *opcional*) : O sigma do próximo passo no cronograma de ruído.

**Retorna:** `torch.Tensor`

O tensor de amostra no passo de tempo anterior.

Um passo para o UniP (versão B(h)). Alternativamente, `self.solver_p` é usado se especificado.

#### set_begin_index[[diffusers.HeliosScheduler.set_begin_index]]

```python
set_begin_index(begin_index: int = 0)
```

[Fonte](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_helios.py#L182)

**Parâmetros:**

begin_index (`int`) : O índice inicial do agendador.

Define o índice inicial para o agendador. Esta função deve ser executada a partir do pipeline antes da inferência.

#### set_timesteps[[diffusers.HeliosScheduler.set_timesteps]]

```python
set_timesteps(num_inference_steps: int, stage_index: int | None = None, device: typing.Union[str, torch.device] = None, sigmas: bool | None = None, mu: bool | None = None, is_amplify_first_chunk: bool = False)
```

[Fonte](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_helios.py#L195)

Definindo os timesteps e sigmas para cada etapa

#### time_shift[[diffusers.HeliosScheduler.time_shift]]

```python
time_shift(mu: float, sigma: float, t: Tensor)
```

[Fonte](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_helios.py#L259)

**Parâmetros:**

mu (`float`) : O parâmetro mu para o deslocamento de tempo.

sigma (`float`) : O parâmetro sigma para o deslocamento de tempo.

t (`torch.Tensor`) : Os timesteps de entrada.

**Retorna:** `torch.Tensor`

Os timesteps deslocados no tempo.

Aplicar o deslocamento temporal aos sigmas.

scheduling_helios

