Skip to content

Commit 87cda1f

Browse files
authored
Move inline comfy.context_windows imports to top-level in model_base.py (#13083)
The recent PR that added resize_cond_for_context_window methods to model classes used inline 'import comfy.context_windows' in each method body. This moves that import to the top-level import section, replacing 4 duplicate inline imports with a single top-level one.
1 parent 45d5c83 commit 87cda1f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

comfy/model_base.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import torch
2222
import logging
2323
import comfy.ldm.lightricks.av_model
24+
import comfy.context_windows
2425
from comfy.ldm.modules.diffusionmodules.openaimodel import UNetModel, Timestep
2526
from comfy.ldm.cascade.stage_c import StageC
2627
from comfy.ldm.cascade.stage_b import StageB
@@ -1383,7 +1384,6 @@ def extra_conds(self, **kwargs):
13831384

13841385
def resize_cond_for_context_window(self, cond_key, cond_value, window, x_in, device, retain_index_list=[]):
13851386
if cond_key == "vace_context":
1386-
import comfy.context_windows
13871387
return comfy.context_windows.slice_cond(cond_value, window, x_in, device, temporal_dim=3, retain_index_list=retain_index_list)
13881388
return super().resize_cond_for_context_window(cond_key, cond_value, window, x_in, device, retain_index_list=retain_index_list)
13891389

@@ -1441,7 +1441,6 @@ def extra_conds(self, **kwargs):
14411441

14421442
def resize_cond_for_context_window(self, cond_key, cond_value, window, x_in, device, retain_index_list=[]):
14431443
if cond_key == "audio_embed":
1444-
import comfy.context_windows
14451444
return comfy.context_windows.slice_cond(cond_value, window, x_in, device, temporal_dim=1)
14461445
return super().resize_cond_for_context_window(cond_key, cond_value, window, x_in, device, retain_index_list=retain_index_list)
14471446

@@ -1463,7 +1462,6 @@ def extra_conds(self, **kwargs):
14631462
return out
14641463

14651464
def resize_cond_for_context_window(self, cond_key, cond_value, window, x_in, device, retain_index_list=[]):
1466-
import comfy.context_windows
14671465
if cond_key == "face_pixel_values":
14681466
return comfy.context_windows.slice_cond(cond_value, window, x_in, device, temporal_dim=2, temporal_scale=4, temporal_offset=1)
14691467
if cond_key == "pose_latents":
@@ -1508,7 +1506,6 @@ def extra_conds_shapes(self, **kwargs):
15081506

15091507
def resize_cond_for_context_window(self, cond_key, cond_value, window, x_in, device, retain_index_list=[]):
15101508
if cond_key == "audio_embed":
1511-
import comfy.context_windows
15121509
return comfy.context_windows.slice_cond(cond_value, window, x_in, device, temporal_dim=1)
15131510
return super().resize_cond_for_context_window(cond_key, cond_value, window, x_in, device, retain_index_list=retain_index_list)
15141511

0 commit comments

Comments
 (0)