From ae485633783a21204c74f97228fad251ac602e7b Mon Sep 17 00:00:00 2001 From: Awni Hannun Date: Thu, 29 Feb 2024 09:40:04 -0800 Subject: [PATCH] Remove gc (#509) * remove gc * remove debug --- llms/mlx_lm/utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/llms/mlx_lm/utils.py b/llms/mlx_lm/utils.py index ba22764c..f5301d64 100644 --- a/llms/mlx_lm/utils.py +++ b/llms/mlx_lm/utils.py @@ -1,7 +1,6 @@ # Copyright © 2023-2024 Apple Inc. import copy -import gc import glob import importlib import json @@ -494,7 +493,7 @@ def save_weights( # necessary ones if donate_weights: weights.clear() - gc.collect() + del weights for i in range(len(shards)): shard = shards[i] @@ -507,7 +506,6 @@ def save_weights( for weight_name in shard.keys(): index_data["weight_map"][weight_name] = shard_name del shard - gc.collect() index_data["weight_map"] = { k: index_data["weight_map"][k] for k in sorted(index_data["weight_map"])