Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions auto_round/compressors/shard_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ def _flush_shard(self):
if self.use_safetensors:
from safetensors.torch import save_file

# Ensure tensors are contiguous in-place to avoid duplicating them in a separate dict,
# which can increase peak RAM usage during saving.
for k, v in list(self.current_shard_tensors.items()):
if isinstance(v, torch.Tensor) and not v.is_contiguous():
self.current_shard_tensors[k] = v.contiguous()
save_file(self.current_shard_tensors, tmp_path)
else:
torch.save(self.current_shard_tensors, tmp_path)
Expand Down
1 change: 1 addition & 0 deletions test/test_cuda/requirements_vllm.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vllm
lm_eval >= 0.4.10
ray
Loading