Skip to content

Commit 2cee68a

Browse files
authored
Merge pull request #181 from coreweave/eta/1d-multibyte-slicing
fix(serialization): Slice 1-D multibyte data as bytes for `pwrite`
2 parents 61bab18 + b1c7873 commit 2cee68a

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## [2.9.1] - 2024-11-27
99

1010
### Fixed
1111

12+
- `TensorSerializer` no longer sometimes fails to serialize very large
13+
1-dimensional tensors with multibyte `dtype`s
1214
- `RedisStreamFile.readable()` and `RedisStreamFile.seekable()` now correctly
1315
return `True`
1416

@@ -407,7 +409,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
407409
- `get_gpu_name`
408410
- `no_init_or_tensor`
409411

410-
[Unreleased]: https://github.com/coreweave/tensorizer/compare/v2.9.0...HEAD
412+
[2.9.1]: https://github.com/coreweave/tensorizer/compare/v2.9.0...v2.9.1
411413
[2.9.0]: https://github.com/coreweave/tensorizer/compare/v2.8.1...v2.9.0
412414
[2.8.1]: https://github.com/coreweave/tensorizer/compare/v2.8.0...v2.8.1
413415
[2.8.0]: https://github.com/coreweave/tensorizer/compare/v2.7.2...v2.8.0

tensorizer/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.9.0"
1+
__version__ = "2.9.1"

tensorizer/serialization.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,7 +3510,7 @@ def _mv_suffix(data: "collections.abc.Buffer", start: int):
35103510
if not isinstance(data, memoryview):
35113511
data = memoryview(data)
35123512
try:
3513-
if data.ndim != 1:
3513+
if data.ndim != 1 or data.format != "B":
35143514
data = data.cast("B")
35153515
return data[start:]
35163516
finally:
@@ -3526,13 +3526,15 @@ def _pwrite_syscall(
35263526
verify if isinstance(verify, int) else self._buffer_size(data)
35273527
)
35283528
bytes_just_written: int = os.pwrite(self._fd, data, offset)
3529-
bytes_written += bytes_just_written
3529+
if bytes_just_written > 0:
3530+
bytes_written += bytes_just_written
35303531
while bytes_written < expected_bytes_written and bytes_just_written > 0:
35313532
# Writes larger than ~2 GiB may not complete in a single pwrite call
35323533
offset += bytes_just_written
35333534
with self._mv_suffix(data, bytes_written) as mv:
35343535
bytes_just_written = os.pwrite(self._fd, mv, offset)
3535-
bytes_written += bytes_just_written
3536+
if bytes_just_written > 0:
3537+
bytes_written += bytes_just_written
35363538
if isinstance(verify, int) or verify:
35373539
self._verify_bytes_written(bytes_written, expected_bytes_written)
35383540
return bytes_written

0 commit comments

Comments
 (0)