Skip to content

Commit

Permalink
clean gc after ckpt to avoid oom (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsja authored Oct 1, 2024
1 parent 18db923 commit a217dfb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/zeroband/checkpoint.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dataclasses import dataclass
import gc
import multiprocessing
import os
import time
Expand Down Expand Up @@ -162,6 +163,8 @@ def save(self, ckpt_path: str, remote_ckpt_path: str | None) -> None:

self._logger.info(f"Saved checkpoint to {ckpt_path} in {time.perf_counter() - time_start} seconds")

gc.collect() # because we are badass engineer

if remote_ckpt_path is not None:
self._async_save_remote(ckpt_path, remote_ckpt_path)

Expand Down

0 comments on commit a217dfb

Please sign in to comment.