mirror of
https://github.com/ml-explore/mlx.git
synced 2025-07-30 06:31:21 +08:00
Eval before cleanup so model file is unlocked (#1702)
This commit is contained in:
parent
f9640e049d
commit
af5a614aad
@ -95,6 +95,9 @@ class TestBase(mlx_tests.MLXTestCase):
|
||||
m.save_weights(npz_file)
|
||||
m_load = make_model()
|
||||
m_load.load_weights(npz_file)
|
||||
|
||||
# Eval before cleanup so model file is unlocked.
|
||||
mx.eval(m_load.state)
|
||||
tdir.cleanup()
|
||||
|
||||
eq_tree = tree_map(mx.array_equal, m.parameters(), m_load.parameters())
|
||||
@ -110,6 +113,9 @@ class TestBase(mlx_tests.MLXTestCase):
|
||||
m.save_weights(safetensors_file)
|
||||
m_load = make_model()
|
||||
m_load.load_weights(safetensors_file)
|
||||
|
||||
# Eval before cleanup so model file is unlocked.
|
||||
mx.eval(m_load.state)
|
||||
tdir.cleanup()
|
||||
|
||||
eq_tree = tree_map(mx.array_equal, m.parameters(), m_load.parameters())
|
||||
|
Loading…
Reference in New Issue
Block a user