Skip to content

Commit

Permalink
Add gc.collect before compress call
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-savelyevv committed Jul 26, 2024
1 parent b5e4267 commit d11b3b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/post_training/pipelines/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import datetime as dt
import gc
import os
import re
import time
Expand Down Expand Up @@ -357,6 +358,7 @@ def compress(self) -> None:

start_time = time.perf_counter()
if self.memory_monitor:
gc.collect()
max_value_per_memory_type = monitor_memory_for_callable(
self._compress,
interval=0.1,
Expand Down
3 changes: 2 additions & 1 deletion tests/post_training/pipelines/lm_weight_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import gc
import os
import re
import shutil
Expand Down Expand Up @@ -182,6 +182,7 @@ def compress(self) -> None:
print("Weight compression...")
start_time = time.perf_counter()
if self.memory_monitor:
gc.collect()
max_value_per_memory_type = monitor_memory_for_callable(
self._compress,
interval=0.1,
Expand Down

0 comments on commit d11b3b7

Please sign in to comment.