Skip to content

Commit 7392c8f

Browse files
authored
[chore] raise as early as possible in group offloading (#11792)
* raise as early as possible in group offloading * remove check from ModuleGroup
1 parent 474a248 commit 7392c8f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/diffusers/hooks/group_offloading.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ def __init__(
9696
else:
9797
self.cpu_param_dict = self._init_cpu_param_dict()
9898

99-
if self.stream is None and self.record_stream:
100-
raise ValueError("`record_stream` cannot be True when `stream` is None.")
101-
10299
def _init_cpu_param_dict(self):
103100
cpu_param_dict = {}
104101
if self.stream is None:
@@ -513,6 +510,9 @@ def apply_group_offloading(
513510
else:
514511
raise ValueError("Using streams for data transfer requires a CUDA device, or an Intel XPU device.")
515512

513+
if not use_stream and record_stream:
514+
raise ValueError("`record_stream` cannot be True when `use_stream=False`.")
515+
516516
_raise_error_if_accelerate_model_or_sequential_hook_present(module)
517517

518518
if offload_type == "block_level":

0 commit comments

Comments
 (0)