olm-chat-7b / clear_memo.py
henhenhahi111112's picture
Upload folder using huggingface_hub
af6e330 verified
raw
history blame contribute delete
361 Bytes
import torch
def cleanup_shared_memory():
import os
import glob
shm_files = glob.glob('/dev/shm/torch_*')
for shm_file in shm_files:
try:
os.remove(shm_file)
except OSError as e:
print(f"Error removing shared memory file {shm_file}: {e}")
# 在主程序开始或结束时调用
cleanup_shared_memory()