Skip to content

fix: release device allocator cache after Accelerate offload - #369

Merged
meichangsu1 merged 1 commit into
modelscope:dev-swift-v5from
werwrewe:fix/offload-release-device-cache
Nov 5, 2026
Merged

meichangsu1 merged 1 commit into
modelscope:dev-swift-v5from
werwrewe:fix/offload-release-device-cache

Conversation

@werwrewe

@werwrewe werwrewe commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

GRPO 训练中,模型和优化器卸载到 CPU 后,原实现仅清理 CUDA 缓存。NPU 上未释放的缓存仍占用显存,可能导致 vLLM 唤醒 KV cache 时出现 aclrtMallocPhysical OOM。

将 CUDA 专用清理替换为已有的 release_caching_allocator()。该函数执行垃圾回收,并调用当前设备后端的缓存清理接口,已覆盖 CUDA empty_cache(),无需保留重复调用。

@werwrewe
werwrewe marked this pull request as draft November 5, 2026 09:19
@werwrewe
werwrewe marked this pull request as ready for review November 5, 2026 09:19
@meichangsu1
meichangsu1 merged commit d93c508 into modelscope:dev-swift-v5 Nov 5, 2026
0 of 5 checks passed
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.

2 participants