Fix improper index slicing for flipflop get blocks, add extra log message

This commit is contained in:
Jedrzej Kosinski 2025-10-01 21:21:36 -07:00
parent 7c896c5567
commit 0df61b5032
2 changed files with 2 additions and 1 deletions

View File

@ -33,7 +33,7 @@ class FlipFlopModule(torch.nn.Module):
if block_type not in self.block_types: if block_type not in self.block_types:
raise ValueError(f"Block type {block_type} not found in {self.block_types}") raise ValueError(f"Block type {block_type} not found in {self.block_types}")
if block_type in self.flipflop: if block_type in self.flipflop:
return getattr(self, block_type)[:self.flipflop[block_type].flip_amount] return getattr(self, block_type)[:self.flipflop[block_type].i_offset]
return getattr(self, block_type) return getattr(self, block_type)
def get_all_block_module_sizes(self, reverse_sort_by_size: bool = False) -> list[tuple[str, int]]: def get_all_block_module_sizes(self, reverse_sort_by_size: bool = False) -> list[tuple[str, int]]:

View File

@ -619,6 +619,7 @@ class ModelPatcher:
def setup_flipflop(self, flipflop_blocks_per_type: dict[str, tuple[int, int]]): def setup_flipflop(self, flipflop_blocks_per_type: dict[str, tuple[int, int]]):
if not self.supports_flipflop(): if not self.supports_flipflop():
return return
logging.info(f"setting up flipflop with {flipflop_blocks_per_type}")
self.model.diffusion_model.setup_flipflop_holders(flipflop_blocks_per_type, self.load_device, self.offload_device) self.model.diffusion_model.setup_flipflop_holders(flipflop_blocks_per_type, self.load_device, self.offload_device)
def init_flipflop_block_copies(self): def init_flipflop_block_copies(self):