Skip to content

Commit

Permalink
拆分utils函数
Browse files Browse the repository at this point in the history
  • Loading branch information
Leroll committed Oct 27, 2023
1 parent 418774e commit 2fabeff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
10 changes: 10 additions & 0 deletions utils/clean_memory.py
Original file line number Diff line number Diff line change
@@ -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()
14 changes: 0 additions & 14 deletions utils/load_google_drive.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#---------------------------------
# colab 加载 google drive
#---------------------------------
Expand All @@ -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()

0 comments on commit 2fabeff

Please sign in to comment.