Skip to content

Commit

Permalink
fix gpu memory growth (#14044)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyubo0722 authored Oct 18, 2024
1 parent 5cf3ac5 commit cb36de1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from __future__ import print_function

import os
import gc
import sys
import platform
import yaml
Expand Down Expand Up @@ -495,6 +496,7 @@ def train(
model,
os.path.join(save_model_dir, prefix, "inference"),
)
gc.collect()
model_info = {"epoch": epoch, "metric": best_model_dict}
else:
model_info = None
Expand Down Expand Up @@ -542,6 +544,7 @@ def train(
prefix = "latest"
if uniform_output_enabled:
export(config, model, os.path.join(save_model_dir, prefix, "inference"))
gc.collect()
model_info = {"epoch": epoch, "metric": best_model_dict}
else:
model_info = None
Expand Down Expand Up @@ -570,6 +573,7 @@ def train(
prefix = "iter_epoch_{}".format(epoch)
if uniform_output_enabled:
export(config, model, os.path.join(save_model_dir, prefix, "inference"))
gc.collect()
model_info = {"epoch": epoch, "metric": best_model_dict}
else:
model_info = None
Expand Down

0 comments on commit cb36de1

Please sign in to comment.