Skip to content

Add support for loading GPTQ models via AutoGPTQ - #519

Merged
StellaAthena merged 3 commits into
EleutherAI:masterfrom
gakada:gptq
May 27, 2023
Merged

StellaAthena merged 3 commits into
EleutherAI:masterfrom
gakada:gptq

Conversation

@gakada

@gakada gakada commented May 23, 2023

Copy link
Copy Markdown
Contributor

Using AutoGPTQ.

So far tested for LLaMA-7B quantized with GPTQ-for-LLaMa:

LLaMA-7B @ hellaswag (0-shot) acc acc_norm
8bit 0.5633 Âą 0.0049 0.7298 Âą 0.0044
4bit-128g-ts-ao-c4 0.5612 Âą 0.0050 0.7246 Âą 0.0045

@CLAassistant

CLAassistant commented May 23, 2023 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@StellaAthena StellaAthena left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution! This looks excellent. I've left a couple comments and have one other note:

I can only quickly find benchmarking on Wikitext2 and C4 perplexity. Can you add (with source) the HellaSwag results you're comparing to to conclude it's working correctly? Ideally we'd have comparisons on multiple benchmarks for multiple models.

Comment thread README.md Resolved
Comment thread README.md Resolved
@gakada

gakada commented May 25, 2023

Copy link
Copy Markdown
Contributor Author

Those are the HellaSwag results I've got by running it myself. 8bit is from load_in_8bit=True in --model_args, which is already working, and 4bit is from using a model quantized with

python llama.py llama-7b/ c4 --wbits 4 --true-sequential --act-order --groupsize 128 --save_safetensors llama-7b/model.safetensors

i.e. with quantized=model.safetensors in --model_args.

To put it next to

"hellaswag": {
"acc": 0.563931487751444,
"acc_stderr": 0.004948824501355491,
"acc_norm": 0.7298346942840072,
"acc_norm_stderr": 0.004431375549911366
},

Model acc acc_norm
llama-7b 0.5639 Âą 0.0049 0.7298 Âą 0.0044
llama-7b-8bit 0.5633 Âą 0.0049 0.7298 Âą 0.0044
llama-7b-4bit 0.5612 Âą 0.0050 0.7246 Âą 0.0045

so it appears to be working, as the difference is very small.

@gakada

gakada commented May 25, 2023

Copy link
Copy Markdown
Contributor Author

Should be installed from git right now: pip install auto-gptq[triton]@git+https://github.com/PanQiWei/AutoGPTQ.

@StellaAthena
StellaAthena self-requested a review May 25, 2023 13:40
@StellaAthena

StellaAthena commented May 25, 2023 •

Copy link
Copy Markdown
Member

Should be installed from git right now: pip install auto-gptq[triton]@git+https://github.com/PanQiWei/AutoGPTQ.

Sounds good. If you add this requirement to the set-up code then I think we’re good to merge once we get a couple more evaluations checked. Let’s say Pythia 13B on Lambada and T5-large on the task of your choice?

@gakada

gakada commented May 26, 2023

Copy link
Copy Markdown
Contributor Author

Looks like T5 isn't supported yet:

Currently, auto_gptq supports: bloom, gpt2, gpt_neox, gptj, llama, moss and opt; more Transformer models will come soon!

I will see about running Pythia.

@gakada

gakada commented May 26, 2023

Copy link
Copy Markdown
Contributor Author

Using autobots/pythia-12b-gptqv2-4bit, configs from EleutherAI/pythia-12b, and quantize_config.json with { "bits": 4, "desc_act": true, "group_size": -1 }, 0-shot:

Task Version Metric Value Stderr
lambada_openai 0 ppl 4.1339 Âą 0.0879
acc 0.6872 Âą 0.0065

c.f. https://huggingface.co/EleutherAI/pythia-12b/resolve/main/eval_plots/lambada_openai.png.

@StellaAthena

Copy link
Copy Markdown
Member

Great work, and thank you for the contribution.

We are currently in the process of drafting a paper about this library. Your PR is substantial enough that we would like to offer you coauthorship if you desire. If you would like to be included, please email me saying so.

@StellaAthena
StellaAthena merged commit 095d840 into EleutherAI:master May 27, 2023
qmdnls pushed a commit to qmdnls/lm-evaluation-harness that referenced this pull request Aug 17, 2023
Add support for loading GPTQ models via AutoGPTQ
LZY-the-boys pushed a commit to LZY-the-boys/lm-evaluation-harness-fast that referenced this pull request Sep 12, 2023
Add support for loading GPTQ models via AutoGPTQ
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

Successfully merging this pull request may close these issues.

3 participants