Skip to content

Commit

Permalink
fix mem (NVIDIA#9957)
Browse files Browse the repository at this point in the history
Signed-off-by: Gerald Shen <geshen@nvidia.com>
  • Loading branch information
gshennvm authored Jul 30, 2024
1 parent 7dd9378 commit 68d4dba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nemo/export/tensorrt_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import gc
import json
import logging
import os
Expand Down Expand Up @@ -437,6 +438,8 @@ def refit(self, model, model_config):
tokenizer_vocab_size=self.tokenizer.vocab_size,
)
load_distributed(self.model_dir, self.mp_rank, self.gpus_per_node)
gc.collect()
torch.cuda.empty_cache()
refit(weights_dict)

def forward(
Expand Down

0 comments on commit 68d4dba

Please sign in to comment.