Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when trying to convert LLama 405b to SAXML #29

Open
aalferez123 opened this issue Sep 6, 2024 · 1 comment
Open

Issue when trying to convert LLama 405b to SAXML #29

aalferez123 opened this issue Sep 6, 2024 · 1 comment

Comments

@aalferez123
Copy link

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.loadwithweights_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 forweights_onlywill be flipped toTrue. 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 <module> 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)

@aalferez123
Copy link
Author

Adding more context here. Here are the layer shapes before converting:
Layer 0 wq shape before reshape: (16384, 16384)
Layer 0 wk shape before reshape: (16384, 1024)
Layer 0 wv shape before reshape: (16384, 1024)

And here is the error:
File "/home/jupyter/saxml/saxml/tools/convert_llama_ckpt-fixed.py", line 219, in
convert(args.base_model_path, args.pax_model_path, args.model_size)
File "/home/jupyter/saxml/saxml/tools/convert_llama_ckpt-fixed.py", line 130, 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant