Skip to content

Commit 22e6fc1

Browse files
committed
update
1 parent 1d38a30 commit 22e6fc1

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
@@ -227,10 +227,10 @@ def _offload_to_disk(self):
227227
# overhead. Currently, we just check if the given `safetensors_file_path` exists and if not
228228
# we perform a write.
229229
# Check if the file has been saved in this session or if it already exists on disk.
230-
if not self._is_offloaded_to_disk and not os.path.exists(self.safetensors_file_path):
231-
os.makedirs(os.path.dirname(self.safetensors_file_path), exist_ok=True)
230+
if not self._is_offloaded_to_disk and not os.path.exists(self._disk_offload_file_path):
231+
os.makedirs(os.path.dirname(self._disk_offload_file_path), exist_ok=True)
232232
tensors_to_save = {key: tensor.data.to(self.offload_device) for tensor, key in self.tensor_to_key.items()}
233-
safetensors.torch.save_file(tensors_to_save, self.safetensors_file_path)
233+
safetensors.torch.save_file(tensors_to_save, self._disk_offload_file_path)
234234

235235
# The group is now considered offloaded to disk for the rest of the session.
236236
self._is_offloaded_to_disk = True

0 commit comments

Comments
 (0)