Skip to content

cp: fix(test): clone mmap-backed tensors before overwriting safetensors file (#3335) - #3441

Merged
yaoyu-33 merged 1 commit into
r0.4.0from
cherry-pick-safetensors-fix-r0.4.0
Apr 21, 2026
Merged

cp: fix(test): clone mmap-backed tensors before overwriting safetensors file (#3335)#3441
yaoyu-33 merged 1 commit into
r0.4.0from
cherry-pick-safetensors-fix-r0.4.0

Conversation

@yaoyu-33

Copy link
Copy Markdown
Contributor

Summary

  • Cherry-pick of the safetensors mmap fix from fd648d56 (main, PR chore(beep boop 🤖): Bump uv.lock (main, mcore-main) (2026-04-15) #3335)
  • _fuse_moe_expert_weights loads tensors via safetensors (memory-mapped), then writes back to the same file path. On Docker overlay filesystems in CI, this causes safetensors_rust.SafetensorError: I/O error: Bad address (os error 14) because save_file truncates the file while kept tensors still reference the mmap'd regions
  • Fix: clone kept tensors before saving (v.clone())

Test plan

🤖 Generated with Claude Code

…ile (#3335)

Cherry-pick of the safetensors fix from fd648d5 (main).

_fuse_moe_expert_weights loads tensors via safetensors (memory-mapped),
then writes back to the same file path. On some filesystems (e.g. Docker
overlay in CI), this causes EFAULT because save_file truncates the file
while the kept tensors still reference the mmap'd regions. Cloning the
kept tensors before saving avoids this.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Apr 21, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaoyu-33
yaoyu-33 merged commit 84a87b4 into r0.4.0 Apr 21, 2026
2 checks passed
@yaoyu-33
yaoyu-33 deleted the cherry-pick-safetensors-fix-r0.4.0 branch April 21, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant