Unverified Commit 7392c8ff authored by Sayak Paul's avatar Sayak Paul Committed by GitHub
Browse files

[chore] raise as early as possible in group offloading (#11792)

* raise as early as possible in group offloading

* remove check from ModuleGroup
parent 474a248f
...@@ -96,9 +96,6 @@ class ModuleGroup: ...@@ -96,9 +96,6 @@ class ModuleGroup:
else: else:
self.cpu_param_dict = self._init_cpu_param_dict() self.cpu_param_dict = self._init_cpu_param_dict()
if self.stream is None and self.record_stream:
raise ValueError("`record_stream` cannot be True when `stream` is None.")
def _init_cpu_param_dict(self): def _init_cpu_param_dict(self):
cpu_param_dict = {} cpu_param_dict = {}
if self.stream is None: if self.stream is None:
...@@ -513,6 +510,9 @@ def apply_group_offloading( ...@@ -513,6 +510,9 @@ def apply_group_offloading(
else: else:
raise ValueError("Using streams for data transfer requires a CUDA device, or an Intel XPU device.") raise ValueError("Using streams for data transfer requires a CUDA device, or an Intel XPU device.")
if not use_stream and record_stream:
raise ValueError("`record_stream` cannot be True when `use_stream=False`.")
_raise_error_if_accelerate_model_or_sequential_hook_present(module) _raise_error_if_accelerate_model_or_sequential_hook_present(module)
if offload_type == "block_level": if offload_type == "block_level":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment