# HeliosScheduler

`HeliosScheduler` được xây dựng dựa trên phương pháp lấy mẫu khớp dòng hình chóp (pyramidal flow-matching sampling) được giới thiệu trong [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')
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/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)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_helios.py#L371)

**Tham số:**

model_output (`torch.Tensor`) : Đầu ra trực tiếp từ mô hình khuếch tán đã học.

timestep (`int`) : Bước thời gian rời rạc hiện tại trong chuỗi khuếch tán.

sample (`torch.Tensor`) : Một bản sao mẫu hiện tại được tạo ra bởi quá trình khuếch tán.

sigma (`torch.Tensor`, *tùy chọn*) : Sigma của bước hiện tại trong lịch trình nhiễu.

**Trả về:** `torch.Tensor`

Đầu ra của mô hình đã được chuyển đổi.

Chuyển đổi đầu ra của mô hình sang kiểu tương ứng mà thuật toán UniPC cần.

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

```python
init_sigmas()
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_helios.py#L90)

khởi tạo các bước thời gian và sigma toàn cục

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

```python
init_sigmas_for_each_stage()
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_helios.py#L108)

Khởi tạo các bước thời gian cho từng giai đoạn

#### 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)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_helios.py#L591)

**Tham số:**

this_model_output (`torch.Tensor`) : Đầu ra của mô hình tại `x_t`.

this_timestep (`int`) : Bước thời gian hiện tại `t`.

last_sample (`torch.Tensor`) : Mẫu được tạo ra trước bộ dự đoán cuối cùng `x_{t-1}`.

this_sample (`torch.Tensor`) : Mẫu được tạo ra sau bộ dự đoán cuối cùng `x_{t}`.

order (`int`) : Giá trị `p` của UniC-p tại bước này. Bậc chính xác hiệu dụng nên là `order + 1`.

sigma_before (`torch.Tensor`, *tùy chọn*) : Sigma của bước trước trong lịch trình nhiễu.

sigma (`torch.Tensor`, *tùy chọn*) : Sigma của bước hiện tại trong lịch trình nhiễu.

**Trả về:** `torch.Tensor`

Tensor mẫu đã được hiệu chỉnh tại bước thời gian hiện tại.

Một bước cho UniC (phiên bản 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)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_helios.py#L453)

**Tham số:**

model_output (`torch.Tensor`) : Đầu ra trực tiếp từ mô hình khuếch tán đã học tại bước thời gian hiện tại.

prev_timestep (`int`) : Bước thời gian rời rạc trước đó trong chuỗi khuếch tán.

sample (`torch.Tensor`) : Một bản sao mẫu hiện tại được tạo ra bởi quá trình khuếch tán.

order (`int`) : Bậc của UniP tại bước thời gian này (tương ứng với *p* trong UniPC-p).

sigma (`torch.Tensor`, *tùy chọn*) : Sigma của bước hiện tại trong lịch trình nhiễu.

sigma_next (`torch.Tensor`, *tùy chọn*) : Sigma của bước tiếp theo trong lịch trình nhiễu.

**Trả về:** `torch.Tensor`

Tensor mẫu tại bước thời gian trước đó.

Một bước cho UniP (phiên bản B(h)). Ngoài ra, `self.solver_p` sẽ được sử dụng nếu được chỉ định.

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

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

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_helios.py#L182)

**Tham số:**

begin_index (`int`) : Chỉ số bắt đầu cho trình lập lịch.

Đặt chỉ số bắt đầu cho trình lập lịch. Hàm này nên được chạy từ pipeline trước khi suy luận.

#### 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)
```

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_helios.py#L195)

Đặt các bước thời gian và sigma cho từng giai đoạn

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

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

[Nguồn](https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_helios.py#L259)

**Tham số:**

mu (`float`) : Tham số mu cho việc dịch chuyển thời gian.

sigma (`float`) : Tham số sigma cho phép dịch chuyển thời gian.

t (`torch.Tensor`) : Các bước thời gian đầu vào.

**Trả về:** `torch.Tensor`

Các bước thời gian đã dịch chuyển.

Áp dụng dịch chuyển thời gian vào các sigma.

scheduling_helios

