Skip to content

Commit cf4afe1

Browse files
authored
Fix boundary var issue when chunking model with coremltools 7.0 (#259)
1 parent 7b59c2b commit cf4afe1

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

python_coreml_stable_diffusion/chunk_mlprogram.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,13 @@ def _get_first_chunk_outputs(block, op_idx):
122122
boundary_vars = set()
123123
for i in range(op_idx + 1):
124124
op = block.operations[i]
125-
for var in op.outputs:
126-
if var.val is None: # only consider non const vars
127-
for child_op in var.child_ops:
128-
child_op_idx = block.operations.index(child_op)
129-
if child_op_idx > op_idx:
130-
boundary_vars.add(var)
125+
if not op.op_type.startswith("const"):
126+
for var in op.outputs:
127+
if var.val is None: # only consider non const vars
128+
for child_op in var.child_ops:
129+
child_op_idx = block.operations.index(child_op)
130+
if child_op_idx > op_idx:
131+
boundary_vars.add(var)
131132
return list(boundary_vars)
132133

133134

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
coremltools>=7.0b1
1+
coremltools>=7.0
22
diffusers[torch]
33
torch
44
transformers==4.29.2

0 commit comments

Comments
 (0)