forked from mit-han-lab/llm-awq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Minor] add quantization example scripts & update readme (mit-han-lab…
- Loading branch information
Showing
7 changed files
with
123 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
MODEL=CodeLlama-13b-Instruct | ||
|
||
# run AWQ search (optional; we provided the pre-computed results) | ||
python -m awq.entry --model_path /dataset/codellama-hf/$MODEL \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--run_awq --dump_awq awq_cache/$MODEL-w4-g128.pt | ||
|
||
# evaluate the AWQ quantize model (simulated pseudo quantization) | ||
python -m awq.entry --model_path /dataset/codellama-hf/$MODEL \ | ||
--tasks wikitext \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_awq awq_cache/$MODEL-w4-g128.pt \ | ||
--q_backend fake | ||
|
||
# generate real quantized weights (w4) | ||
python -m awq.entry --model_path /dataset/codellama-hf/$MODEL \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_awq awq_cache/$MODEL-w4-g128.pt \ | ||
--q_backend real --dump_quant quant_cache/$MODEL-w4-g128-awq.pt | ||
|
||
# load and evaluate the real quantized model (smaller gpu memory usage) | ||
python -m awq.entry --model_path /dataset/codellama-hf/$MODEL \ | ||
--tasks wikitext \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_quant quant_cache/$MODEL-w4-g128-awq.pt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
MODEL=llama-2-7b | ||
|
||
# run AWQ search (optional; we provided the pre-computed results) | ||
python -m awq.entry --model_path /dataset/llama2-hf/$MODEL \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--run_awq --dump_awq awq_cache/$MODEL-w4-g128.pt | ||
|
||
# evaluate the AWQ quantize model (simulated pseudo quantization) | ||
python -m awq.entry --model_path /dataset/llama2-hf/$MODEL \ | ||
--tasks wikitext \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_awq awq_cache/$MODEL-w4-g128.pt \ | ||
--q_backend fake | ||
|
||
# generate real quantized weights (w4) | ||
python -m awq.entry --model_path /dataset/llama2-hf/$MODEL \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_awq awq_cache/$MODEL-w4-g128.pt \ | ||
--q_backend real --dump_quant quant_cache/$MODEL-w4-g128-awq.pt | ||
|
||
# load and evaluate the real quantized model (smaller gpu memory usage) | ||
python -m awq.entry --model_path /dataset/llama2-hf/$MODEL \ | ||
--tasks wikitext \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_quant quant_cache/$MODEL-w4-g128-awq.pt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
MODEL=llava-13b-v0 | ||
|
||
# run AWQ search (optional; we provided the pre-computed results) | ||
python -m awq.entry --model_path /dataset/llava-hf/$MODEL \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--run_awq --dump_awq awq_cache/$MODEL-w4-g128.pt | ||
|
||
# generate real quantized weights (w4) | ||
python -m awq.entry --model_path /dataset/llava-hf/$MODEL \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_awq awq_cache/$MODEL-w4-g128.pt \ | ||
--q_backend real --dump_quant quant_cache/$MODEL-w4-g128-awq.pt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
MODEL=starcoder | ||
|
||
# run AWQ search (optional; we provided the pre-computed results) | ||
python -m awq.entry --model_path /dataset/starcoder-hf/$MODEL \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--run_awq --dump_awq awq_cache/$MODEL-w4-g128.pt | ||
|
||
# evaluate the AWQ quantize model (simulated pseudo quantization) | ||
python -m awq.entry --model_path /dataset/starcoder-hf/$MODEL \ | ||
--tasks wikitext \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_awq awq_cache/$MODEL-w4-g128.pt \ | ||
--q_backend fake | ||
|
||
# generate real quantized weights (w4) | ||
python -m awq.entry --model_path /dataset/starcoder-hf/$MODEL \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_awq awq_cache/$MODEL-w4-g128.pt \ | ||
--q_backend real --dump_quant quant_cache/$MODEL-w4-g128-awq.pt | ||
|
||
# load and evaluate the real quantized model (smaller gpu memory usage) | ||
python -m awq.entry --model_path /dataset/starcoder-hf/$MODEL \ | ||
--tasks wikitext \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_quant quant_cache/$MODEL-w4-g128-awq.pt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
MODEL=vicuna-7b | ||
|
||
# run AWQ search (optional; we provided the pre-computed results) | ||
python -m awq.entry --model_path /dataset/vicuna-hf/$MODEL \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--run_awq --dump_awq awq_cache/$MODEL-w4-g128.pt | ||
|
||
# evaluate the AWQ quantize model (simulated pseudo quantization) | ||
python -m awq.entry --model_path /dataset/vicuna-hf/$MODEL \ | ||
--tasks wikitext \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_awq awq_cache/$MODEL-w4-g128.pt \ | ||
--q_backend fake | ||
|
||
# generate real quantized weights (w4) | ||
python -m awq.entry --model_path /dataset/vicuna-hf/$MODEL \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_awq awq_cache/$MODEL-w4-g128.pt \ | ||
--q_backend real --dump_quant quant_cache/$MODEL-w4-g128-awq.pt | ||
|
||
# load and evaluate the real quantized model (smaller gpu memory usage) | ||
python -m awq.entry --model_path /dataset/vicuna-hf/$MODEL \ | ||
--tasks wikitext \ | ||
--w_bit 4 --q_group_size 128 \ | ||
--load_quant quant_cache/$MODEL-w4-g128-awq.pt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters