mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-22 12:20:16 +08:00
Update context_windows.py
This commit is contained in:
parent
928fd4d13f
commit
ac93376ef8
@ -564,6 +564,7 @@ def shift_window_to_end(window: list[int], num_frames: int):
|
|||||||
# 2) add end_delta to each val to slide windows to end
|
# 2) add end_delta to each val to slide windows to end
|
||||||
window[i] = window[i] + end_delta
|
window[i] = window[i] + end_delta
|
||||||
|
|
||||||
|
|
||||||
# https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved/blob/90fb1331201a4b29488089e4fbffc0d82cc6d0a9/animatediff/sample_settings.py#L465
|
# https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved/blob/90fb1331201a4b29488089e4fbffc0d82cc6d0a9/animatediff/sample_settings.py#L465
|
||||||
def apply_freenoise(noise: torch.Tensor, context_length: int, context_overlap: int, seed: int):
|
def apply_freenoise(noise: torch.Tensor, context_length: int, context_overlap: int, seed: int):
|
||||||
logging.info(f"Context windows: Applying FreeNoise")
|
logging.info(f"Context windows: Applying FreeNoise")
|
||||||
@ -585,4 +586,4 @@ def apply_freenoise(noise: torch.Tensor, context_length: int, context_overlap: i
|
|||||||
list_idx = torch.tensor(list(range(start_idx,start_idx+delta)), device=torch.device("cpu"), dtype=torch.long)
|
list_idx = torch.tensor(list(range(start_idx,start_idx+delta)), device=torch.device("cpu"), dtype=torch.long)
|
||||||
list_idx = list_idx[torch.randperm(delta, generator=generator)]
|
list_idx = list_idx[torch.randperm(delta, generator=generator)]
|
||||||
noise[:, :, place_idx:place_idx + delta] = noise[:, :, list_idx]
|
noise[:, :, place_idx:place_idx + delta] = noise[:, :, list_idx]
|
||||||
return noise
|
return noise
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user