yurekami ef89079712 fix: suppress UserWarning for non-writable buffer in binary2tensor
Use bytearray to create a mutable copy of the binary data before
passing to np.frombuffer. This ensures the numpy array is writable,
avoiding UserWarning from torch.from_numpy on read-only arrays.

The warning occurred because base64.b64decode returns immutable bytes,
and np.frombuffer on immutable bytes returns a read-only array. When
converted to a torch tensor via torch.from_numpy, PyTorch would emit:
"UserWarning: The given buffer is not writable..."

This fix maintains the efficient numpy-based conversion while ensuring
compatibility with all embed_dtype formats (float32, float16, bfloat16,
fp8_e4m3, fp8_e5m2) that numpy doesn't natively support.

Fixes #26781

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: yurekami <yurekami@users.noreply.github.com>
2025-12-25 02:47:19 +09:00
..