Files
MinerU/magic_pdf/libs/clean_memory.py
myhloli 4c9bf8abd5 refactor(memory management): remove unused clean_memory function
The clean_memory function has been removed from pdf_parse_union_core_v2.py due to it not being used.
This change streamlines the code and prevents potential confusion regarding its purpose.
2024-09-29 10:47:54 +08:00

10 lines
211 B
Python

# Copyright (c) Opendatalab. All rights reserved.
import torch
import gc
def clean_memory():
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.cuda.ipc_collect()
gc.collect()