Repository navigation
Replies: 2 comments
|
A 2x increase from 13 GB to 26 GB usually means the converted weights were saved in a larger dtype, most likely float32 instead of float16. So this may still be correct. The main things to check are: the --dtype used during conversion If the output was saved as float32, then the size doubling is expected. If you want a smaller file, try converting with --dtype float16 or using quantization. |
|
It is dtype, and you can pin it down exactly rather than guessing.
In that script the output dtype is decided entirely by def torch_to_mx(a: torch.Tensor, *, dtype: str) -> mx.array:
# bfloat16 is not numpy convertible. Upcast to float32 to avoid precision loss
a = a.to(torch.float32) if dtype == "bfloat16" else a.to(getattr(torch, dtype))
return mx.array(a.numpy(), getattr(mx, dtype))The default is Check your own file without re-converting: import mlx.core as mx
print({str(v.dtype) for v in mx.load("weights.npz").values()})Two notes if you are hitting this now rather than back then. SmolLM2-135M, mlx-lm 0.31.3. |
Uh oh!
There was an error while loading. Please reload this page.
I use convert.py to convert llama's pth file into npz file, but the size goes from 13GB to 26GB.
I don't know if it is correct.
All reactions