diff --git a/utils/clean_memory.py b/utils/clean_memory.py new file mode 100644 index 0000000..9604805 --- /dev/null +++ b/utils/clean_memory.py @@ -0,0 +1,10 @@ +#--------------------------------- +# Function to clean RAM & vRAM +#--------------------------------- +import gc +import ctypes +import torch +def clean_memory(): + gc.collect() + ctypes.CDLL("libc.so.6").malloc_trim(0) + torch.cuda.empty_cache() \ No newline at end of file diff --git a/utils/load_google_drive.py b/utils/load_google_drive.py index f955869..752fab6 100644 --- a/utils/load_google_drive.py +++ b/utils/load_google_drive.py @@ -1,5 +1,3 @@ - - #--------------------------------- # colab 加载 google drive #--------------------------------- @@ -16,15 +14,3 @@ def load_google_drive(path='/'): os.chdir(root_path + path) print(f"cwd: {os.getcwd()}") - - -#--------------------------------- -# Function to clean RAM & vRAM -#--------------------------------- -import gc -import ctypes -import torch -def clean_memory(): - gc.collect() - ctypes.CDLL("libc.so.6").malloc_trim(0) - torch.cuda.empty_cache() \ No newline at end of file