Downloads · 30 days
44
8% of all-time downloads
mattmalcher/Llama-3-70B-Instruct-awq
Llama-3-70B-Instruct-awq is a text generation model from mattmalcher. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as llama3.
I wanted to be able to go from the Meta model weights to an AWQ quantised model myself, rather than grab the weights from casperhansen or elsewhere.
Downloads · 30 days
44
8% of all-time downloads
All-time downloads
568
Public
Parameters
70.6B
39.8 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors39.8 GB · 100%
How the weights are stored.
I3268.5B · 97%
From the Hugging Face model README
I wanted to be able to go from the Meta model weights to an AWQ quantised model myself, rather than grab the weights from casperhansen or elsewhere.
Initially I tried running autoawq on an aws g5.12xlarge instance (4xA10), ubuntu 22, cuda 12.2, nvidia 535.113.01 drivers.
I tried different combinations of torch (2.1.2, 2.2.2), autoawq (0.2.4, 0.2.5) and transformers (4.38.2, 4.41.2), but I couldnt get it to work, even with the 8B model, (which all below errors are for). I kept getting errors like:
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cuda:1)"auto" failed at 16% & index < sizes[i] && "index out of bounds" failed.`File "{redacted}/.venv/lib/python3.11/site-packages/awq/quantize/quantizer.py"", line 69, in pseudo_quantize_tensor assert torch.isnan(w).sum() == 0"RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cuda:1)The only thing that worked was setting CUDA_VISIBLE_DEVICES=0 or to a single device, but this would not work for the 70B model (vram) Though the comment from casper here makes me think quantising llama 3 70B with multiple GPUs should be possible.
The following worked for me:
Machine: vast.ai 2xA100 PCIE instance with AMD EPYC 9554, CUDA 12.2 (~ half the price of the g5.12x large!)
Container: pytorch:2.2.0-cuda12.1-cudnn8-devel image
AutoAWQ @ 5f3785dc
Followed commands in the readme:
git clone https://github.com/casper-hansen/AutoAWQ
cd AutoAWQ
pip install -e .
Installed vim to edit the example script: apt install vim, vi examples/quantize.py
Changed model path to:
meta-llama/Meta-Llama-3-70B-Instruct
Changed output path to:
Meta-Llama-3-70B-Instruct-awq
Used a script to set the token so we can pull llama 3
#!/usr/bin/env bash
export HF_TOKEN=${your token here - used to grab llama weights}
python quantize.py
This worked, took ~ 100 mins for the 70B model to quantise. Not sure if the second A100 was used, once I set the thing running I couldnt figure out how to open a second ssh session to run nvidia-smi or similar without joining the same tmux session running the quantisation, so just left it to it.