frogleo commited on
Commit
58cfe29
·
1 Parent(s): 23063b3

补全丢失的方法

Browse files
Files changed (2) hide show
  1. __pycache__/utils.cpython-310.pyc +0 -0
  2. utils.py +7 -0
__pycache__/utils.cpython-310.pyc CHANGED
Binary files a/__pycache__/utils.cpython-310.pyc and b/__pycache__/utils.cpython-310.pyc differ
 
utils.py CHANGED
@@ -93,3 +93,10 @@ def upscale(
93
  width = round(samples.shape[3] * scale_by)
94
  height = round(samples.shape[2] * scale_by)
95
  return common_upscale(samples, width, height, upscale_method)
 
 
 
 
 
 
 
 
93
  width = round(samples.shape[3] * scale_by)
94
  height = round(samples.shape[2] * scale_by)
95
  return common_upscale(samples, width, height, upscale_method)
96
+
97
+ def free_memory() -> None:
98
+ """Free up GPU and system memory."""
99
+ if torch.cuda.is_available():
100
+ torch.cuda.empty_cache()
101
+ torch.cuda.ipc_collect()
102
+ gc.collect()