Skip to content

Commit

Permalink
fix illeagal block is swapped #1764
Browse files Browse the repository at this point in the history
  • Loading branch information
kohya-ss committed Nov 7, 2024
1 parent b8d3fec commit 186aa5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/flux_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ def forward(

def submit_move_blocks(blocks, block_idx_to_cpu, block_idx_to_cuda):
def move_blocks(bidx_to_cpu, block_to_cpu, bidx_to_cuda, block_to_cuda):
start_time = time.perf_counter()
# start_time = time.perf_counter()
# print(f"Moving {bidx_to_cpu} to cpu and {bidx_to_cuda} to cuda.")
utils.swap_weight_devices(block_to_cpu, block_to_cuda)
# print(f"Block move done. {bidx_to_cpu} to cpu, {bidx_to_cuda} to cuda.")
Expand Down Expand Up @@ -1123,7 +1123,7 @@ def wait_for_blocks_move(block_idx, ftrs):

if block_idx < self.single_blocks_to_swap:
block_idx_to_cpu = block_idx
block_idx_to_cuda = self.num_single_blocks - self.blocks_to_swap + block_idx
block_idx_to_cuda = self.num_single_blocks - self.single_blocks_to_swap + block_idx
future = submit_move_blocks(self.single_blocks, block_idx_to_cpu, block_idx_to_cuda)
single_futures[block_idx_to_cuda] = future

Expand Down

0 comments on commit 186aa5b

Please sign in to comment.