Skip to content

Commit c8cd7ad

Browse files
Use stream for casting if enabled. (comfyanonymous#7833)
1 parent 542b4b3 commit c8cd7ad

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

comfy/model_management.py

+3
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,9 @@ def cast_to(weight, dtype=None, device=None, non_blocking=False, copy=False, str
980980
if not copy:
981981
if dtype is None or weight.dtype == dtype:
982982
return weight
983+
if stream is not None:
984+
with stream:
985+
return weight.to(dtype=dtype, copy=copy)
983986
return weight.to(dtype=dtype, copy=copy)
984987

985988
if stream is not None:

0 commit comments

Comments
 (0)