Issue when trying to convert LLama 405b to SAXML
- Dominant language
- Python
- Stars
- 156
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
After downloading the 405B Model, I try to run the tool convert_llama_ckpt.py but I keep getting this error. I am using :
Compute: n2d-highmem-96 with 768 GB of memory on Vertex Workbench
Python version: Python 3.10.14
`python3 saxml/saxml/tools/convert_llama_ckpt.py --base /home/jupyter/.llama/checkpoints/Meta-Llama3.1-405B-Instruct/ --pax /home/jupyter/saxmlllama --model-size llama3_405b
Loading the base model from /home/jupyter/.llama/checkpoints/Meta-Llama3.1-405B-Instruct/
Loading checkpoint 1 of 8 ...
/home/jupyter/saxml/saxml/tools/convert_llama_ckpt.py:116: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
checkpoint = torch.load(ckpt_path, map_location='cpu')
Loading checkpoint 2 of 8 ...
Loading checkpoint 3 of 8 ...
Loading checkpoint 4 of 8 ...
Loading checkpoint 5 of 8 ...
Loading checkpoint 6 of 8 ...
Loading checkpoint 7 of 8 ...
Loading checkpoint 8 of 8 ...
Traceback (most recent call last):
File "/home/jupyter/saxml/saxml/tools/convert_llama_ckpt.py", line 239, in
convert(args.base_model_path, args.pax_model_path, args.model_size)
File "/home/jupyter/saxml/saxml/tools/convert_llama_ckpt.py", line 150, in convert
wk = np.reshape(wk, [num_heads * dims_per_head, num_kv_heads, dims_per_head])
File "/opt/conda/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 285, in reshape
return _wrapfunc(a, 'reshape', newshape, order=order)
File "/opt/conda/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 59, in _wrapfunc
return bound(*args, **kwds)
ValueError: cannot reshape array of size 16777216 into shape (16384,16,128)`
Contributor guide
Assessment
This issue has not been assessed yet.