[Bug] Fix the OOM condition for CPU cache (#260)

This commit is contained in:
Zhuohan Li
2023-06-26 11:16:13 -07:00
committed by GitHub
parent 471a7a4566
commit 0b7db411b5
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -113,6 +113,8 @@ class Worker:
num_gpu_blocks = int((total_gpu_memory * gpu_memory_utilization
- peak_memory) // cache_block_size)
num_cpu_blocks = int(cpu_swap_space // cache_block_size)
num_gpu_blocks = max(num_gpu_blocks, 0)
num_cpu_blocks = max(num_cpu_blocks, 0)
torch.cuda.empty_cache()
# Reset the seed to ensure that the random state is not affected by