Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,19 @@ def set_shift(self, shift: float):
def scale_noise(
self,
sample: torch.FloatTensor,
timestep: Union[float, torch.FloatTensor],
noise: Optional[torch.FloatTensor] = None,
timestep: torch.FloatTensor,
noise: torch.FloatTensor,
) -> torch.FloatTensor:
"""
Forward process in flow-matching

Args:
sample (`torch.FloatTensor`):
The input sample.
timestep (`int`, *optional*):
timestep (`torch.FloatTensor`):
The current timestep in the diffusion chain.
noise (`torch.FloatTensor`):
The noise tensor.

Returns:
`torch.FloatTensor`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,19 @@ def set_begin_index(self, begin_index: int = 0):
def scale_noise(
self,
sample: torch.FloatTensor,
timestep: Union[float, torch.FloatTensor],
noise: Optional[torch.FloatTensor] = None,
timestep: torch.FloatTensor,
noise: torch.FloatTensor,
) -> torch.FloatTensor:
"""
Forward process in flow-matching

Args:
sample (`torch.FloatTensor`):
The input sample.
timestep (`int`, *optional*):
timestep (`torch.FloatTensor`):
The current timestep in the diffusion chain.
noise (`torch.FloatTensor`):
The noise tensor.

Returns:
`torch.FloatTensor`:
Expand All @@ -130,6 +132,7 @@ def scale_noise(
self._init_step_index(timestep)

sigma = self.sigmas[self.step_index]

sample = sigma * noise + (1.0 - sigma) * sample

return sample
Expand Down
8 changes: 5 additions & 3 deletions src/diffusers/schedulers/scheduling_flow_match_lcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,19 @@ def set_scale_factors(self, scale_factors: list, upscale_mode):
def scale_noise(
self,
sample: torch.FloatTensor,
timestep: Union[float, torch.FloatTensor],
noise: Optional[torch.FloatTensor] = None,
timestep: torch.FloatTensor,
noise: torch.FloatTensor,
) -> torch.FloatTensor:
"""
Forward process in flow-matching

Args:
sample (`torch.FloatTensor`):
The input sample.
timestep (`int`, *optional*):
timestep (`torch.FloatTensor`):
The current timestep in the diffusion chain.
noise (`torch.FloatTensor`):
The noise tensor.

Returns:
`torch.FloatTensor`:
Expand Down