3 Commits

Author SHA1 Message Date
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
Cyrus Leung
7c2bdb83dc
[Misc] Clean up utils (#27552)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
2025-10-27 09:05:40 +00:00
wang.yuqi
1f633b8632
[Frontend][3/N] Improve all pooling task | Support binary embedding response (#27066)
Signed-off-by: wang.yuqi <noooop@126.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
2025-10-22 18:38:57 +08:00