This commit is contained in:
OlivierDehaene 2023-07-19 01:50:19 +02:00
parent 0a02801822
commit 406b094002

View File

@ -743,9 +743,9 @@ class FlashCausalLM(Model):
total_gpu_memory = torch.cuda.get_device_properties(self.device).total_memory
# 0.99 to add some wiggle room
# 0.985 to add some wiggle room
num_blocks = (
int((total_gpu_memory * 0.99 - peak_memory) // total_cache_size)
int((total_gpu_memory * 0.985 - peak_memory) // total_cache_size)
# Add batch.blocks as we allocated it above, so it is included in the peak memory.
+ batch.blocks
)