This commit is contained in:
Artiprocher
2025-11-20 17:44:00 +08:00
parent eeb55a0ce6
commit 96daa30bcc
7 changed files with 72 additions and 24 deletions

View File

@@ -60,9 +60,10 @@ class DiskMap:
if self.rename_dict is not None: name = self.rename_dict[name]
file_id = self.name_map[name]
param = self.files[file_id].get_tensor(name)
if self.torch_dtype is not None:
if self.torch_dtype is not None and isinstance(param, torch.Tensor):
param = param.to(self.torch_dtype)
self.num_params += param.numel()
if isinstance(param, torch.Tensor):
self.num_params += param.numel()
if self.num_params > self.buffer_size:
self.flush_files()
return param