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

Support ShadowKV and fix bugs #291

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
base:
seed: &seed 42
model:
type: Qwen2
path: /home/gushiqiao/nvme/gushiqiao/bussinesss/code_72b/SenseChat-Code-Tmp
tokenizer_mode: fast
torch_dtype: auto
calib:
name: pileval
download: False
path: /home/gushiqiao/nvme/gushiqiao/llm_datasets/calib/pileval
n_samples: 256
bs: -1
seq_len: 512
preproc: txt_general_preproc
seed: *seed
# eval:
# - eval_pos: [ fake_quant]
# name: wikitext2
# download: False
# path: /home/gushiqiao/nvme/gushiqiao/llm_datasets/eval/wikitext2
# seq_len: 2048
# # For 7B / 13B model eval, bs can be set to "1", and inference_per_block can be set to "False".
# # For 70B model eval, bs can be set to "20", and inference_per_block can be set to "True".
# bs: 10
# inference_per_block: True
quant:
method: Awq
weight:
bit: 8
symmetric: True
granularity: per_channel
group_size: -1
act:
bit: 8
symmetric: True
granularity: per_token
special:
trans: True
trans_version: v2
weight_clip: False
awq_bs: 128
quant_out: True
save:
save_trans: True
save_path: ./awq_test_new_pileval_down_ov/
3 changes: 2 additions & 1 deletion configs/quantization/backend/sglang/fp8/awq_fp8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ eval:
inference_per_block: False
quant:
method: Awq
quant_type: float-quant
weight:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
granularity: per_channel
use_qtorch: True
act:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/backend/sglang/fp8/awq_fp8_static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ eval:
inference_per_block: False
quant:
method: Awq
quant_type: float-quant
weight:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
granularity: per_tensor
use_qtorch: True
act:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/backend/sglang/fp8/gptq_fp8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ eval:
inference_per_block: False
quant:
method: GPTQ
quant_type: float-quant
weight:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
granularity: per_channel
use_qtorch: True
act:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/backend/sglang/fp8/rtn_fp8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ eval:
inference_per_block: False
quant:
method: RTN
quant_type: float-quant
weight:
quant_type: float-quant
bit: e4m3
symmetric: True
granularity: per_channel
use_qtorch: True
act:
quant_type: float-quant
bit: e4m3
symmetric: True
granularity: per_token
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/backend/sglang/fp8/smoothquant_fp8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ eval:
seq_len: 2048
quant:
method: SmoothQuant
quant_type: float-quant
weight:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
granularity: per_channel
use_qtorch: True
act:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/backend/vllm/fp8/awq_fp8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ eval:
inference_per_block: False
quant:
method: Awq
quant_type: float-quant
weight:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
granularity: per_channel
use_qtorch: True
act:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/backend/vllm/fp8/awq_fp8_static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ eval:
inference_per_block: False
quant:
method: Awq
quant_type: float-quant
weight:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
granularity: per_tensor
use_qtorch: True
act:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/backend/vllm/fp8/gptq_fp8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ eval:
inference_per_block: False
quant:
method: GPTQ
quant_type: float_quant
weight:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
granularity: per_channel
use_qtorch: True
act:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/backend/vllm/fp8/rtn_fp8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ eval:
inference_per_block: False
quant:
method: RTN
quant_type: float-quant
weight:
quant_type: float-quant
bit: e4m3
symmetric: True
granularity: per_channel
use_qtorch: True
act:
quant_type: float-quant
bit: e4m3
symmetric: True
granularity: per_token
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/backend/vllm/fp8/smoothquant_fp8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ eval:
seq_len: 2048
quant:
method: SmoothQuant
quant_type: float-quant
weight:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
granularity: per_channel
use_qtorch: True
act:
quant_type: float-quant
# Support ["e4m3", "e5m2"]
bit: e4m3
symmetric: True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ eval:
inference_per_block: False
quant:
method: Awq
quant_type: float-quant
weight:
quant_type: float-quant
bit: e2m1
symmetric: False
granularity: per_group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ eval:
inference_per_block: False
quant:
method: GPTQ
quant_type: float-quant
weight:
quant_type: float-quant
bit: e2m1
symmetric: True
granularity: per_group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ eval:
inference_per_block: False
quant:
method: RTN
quant_type: float-quant
weight:
quant_type: float-quant
bit: e2m1
symmetric: True
granularity: per_group
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/methods/FP_Quant/rtn_we2m1ae2m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ eval:
inference_per_block: False
quant:
method: RTN
quant_type: float-quant
weight:
quant_type: float-quant
bit: e2m1
symmetric: True
granularity: per_channel
act:
quant_type: float-quant
bit: e2m1
symmetric: True
granularity: per_token
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/methods/FP_Quant/rtn_we4m3ae4m3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ eval:
inference_per_block: False
quant:
method: RTN
quant_type: float-quant
weight:
quant_type: float-quant
bit: e4m3
symmetric: True
granularity: per_channel
act:
quant_type: float-quant
bit: e4m3
symmetric: True
granularity: per_token
Expand Down
3 changes: 2 additions & 1 deletion configs/quantization/methods/FP_Quant/rtn_we5m2ae5m2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ eval:
inference_per_block: False
quant:
method: RTN
quant_type: float-quant
weight:
quant_type: float-quant
bit: e5m2
symmetric: True
granularity: per_channel
act:
quant_type: float-quant
bit: e5m2
symmetric: True
granularity: per_token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ model:
path: model path
torch_dtype: auto
eval:
eval_pos: [transformed, fake_quant, fake_quant_wo_kv] #long_ppl eval not support pretrain eval pos
eval_pos: [transformed, fake_quant, fake_quant_wo_kv] #decode_ppl eval not support pretrain eval pos
name: wikitext2
type: decode_ppl
download: False
path: eval_data_path
bs: 1
inference_per_block: False
num_samples: 10
num_samples: 50
# num_eval_tokens: 3
quant:
method: RTN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ model:
path: model path
torch_dtype: auto
eval:
eval_pos: [transformed, fake_quant, fake_quant_wo_kv] #long_ppl eval not support pretrain eval pos
eval_pos: [transformed, fake_quant, fake_quant_wo_kv] #decode_ppl eval not support pretrain eval pos
name: wikitext2
type: decode_ppl
download: False
path: eval_data_path
bs: 1
inference_per_block: False
num_samples: 10
num_samples: 50
# num_eval_tokens: 3
quant:
method: RTN
Expand Down
38 changes: 0 additions & 38 deletions configs/quantization/methods/KVQuant/rtn_w_a_sink_quant_kv.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ quant:
symmetric: True
granularity: per_tensor
static: True
calib_algo: static_hist
save:
save_fake: False
save_path: /path/to/save/
Loading
Loading