@@ -263,32 +263,6 @@ def save(tensors: Dict[str, torch.Tensor], metadata: Optional[Dict[str, str]] =
263
263
return result
264
264
265
265
266
- def save_iter (tensors : Dict [str , torch .Tensor ], metadata : Optional [Dict [str , str ]] = None ):
267
- """
268
- Saves a dictionary of tensors into raw bytes in bintensors format.
269
-
270
- Args:
271
- tensors (`Dict[str, torch.Tensor]`):
272
- The incoming tensors. Tensors need to be contiguous and dense.
273
- metadata (`Dict[str, str]`, *optional*, defaults to `None`):
274
- Optional text only metadata you might want to save in your header.
275
- For instance it can be useful to specify more about the underlying
276
- tensors. This is purely informative and does not affect tensor loading.
277
-
278
- Returns:
279
- `bytes`: The raw bytes representing the format
280
-
281
- Example:
282
-
283
- ```python
284
- from bintensors.torch import save_iter
285
- import torch
286
-
287
- tensors = {"embedding": torch.zeros((512, 1024)), "attention": torch.zeros((256, 256))}
288
- buffer = save_iter(tensors)
289
- ```
290
- """
291
-
292
266
def save_with_checksum (
293
267
tensor_dict : Dict [str , torch .Tensor ],
294
268
metadata : Optional [Dict [str , str ]] = None ,
@@ -459,6 +433,7 @@ def _getdtype(dtype_str: str) -> Optional[torch.dtype]:
459
433
460
434
461
435
def _view2torch (safeview ) -> Dict [str , torch .Tensor ]:
436
+ """"""
462
437
result = {}
463
438
for k , v in safeview :
464
439
dtype = _getdtype (v ["dtype" ])
0 commit comments