mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-06-24 17:31:18 +08:00
parent
13794a05da
commit
ae48563378
@ -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"])
|
||||||
|
Loading…
Reference in New Issue
Block a user