Remove gc (#509)

* remove gc

* remove debug
This commit is contained in:
Awni Hannun 2024-02-29 09:40:04 -08:00 committed by GitHub
parent 13794a05da
commit ae48563378
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,6 @@
# Copyright © 2023-2024 Apple Inc. # Copyright © 2023-2024 Apple Inc.
import copy import copy
import gc
import glob import glob
import importlib import importlib
import json import json
@ -494,7 +493,7 @@ def save_weights(
# necessary ones # necessary ones
if donate_weights: if donate_weights:
weights.clear() weights.clear()
gc.collect() del weights
for i in range(len(shards)): for i in range(len(shards)):
shard = shards[i] shard = shards[i]
@ -507,7 +506,6 @@ def save_weights(
for weight_name in shard.keys(): for weight_name in shard.keys():
index_data["weight_map"][weight_name] = shard_name index_data["weight_map"][weight_name] = shard_name
del shard del shard
gc.collect()
index_data["weight_map"] = { index_data["weight_map"] = {
k: index_data["weight_map"][k] for k in sorted(index_data["weight_map"]) k: index_data["weight_map"][k] for k in sorted(index_data["weight_map"])