Skip to content

Commit

Permalink
Update Test Recipes for Latest Modifier Changes (#2326)
Browse files Browse the repository at this point in the history
* update recipes for new modifier

* fixes

---------

Co-authored-by: dbogunowicz <97082108+dbogunowicz@users.noreply.github.com>
  • Loading branch information
Sara Adkins and dbogunowicz authored Jun 17, 2024
1 parent 813033e commit 4399503
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 63 deletions.
27 changes: 1 addition & 26 deletions tests/sparseml/transformers/obcq/recipes/quant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,7 @@ test_stage:
[["re:.*q_proj", "re:.*k_proj", "re:.*v_proj"], "re:.*input_layernorm"],
[["re:.*gate_proj", "re:.*up_proj"], "re:.*post_attention_layernorm"]
]
LegacyQuantizationModifier:
ignore:
- LlamaRotaryEmbedding
- LlamaRMSNorm
- SiLU
- model.layers.0.mlp.down_proj
- model.layers.1.mlp.down_proj
- model.layers.2.mlp.down_proj
- model.layers.3.mlp.down_proj
- model.layers.4.mlp.down_proj
- model.layers.5.mlp.down_proj
scheme_overrides:
Embedding:
input_activations: null
weights:
num_bits: 8
symmetric: False
GPTQModifier:
block_size: 128
sequential_update: False
percdamp: 0.01
targets: [
"model.layers.0",
"model.layers.1",
"model.layers.2",
"model.layers.3",
"model.layers.4",
"model.layers.5"
]
percdamp: 0.01
37 changes: 7 additions & 30 deletions tests/sparseml/transformers/obcq/recipes/quant_and_sparse.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
test_stage:
obcq_modifiers:
SparseGPTModifier:
sparsity: 0.5
block_size: 128
sequential_update: False
percdamp: 0.01
mask_structure: "0:0"
SmoothQuantModifier:
smoothing_strength: 0.5
mappings: [
Expand All @@ -11,13 +17,6 @@ test_stage:
- LlamaRotaryEmbedding
- LlamaRMSNorm
- SiLU
- model.layers.0.mlp.down_proj
- model.layers.1.mlp.down_proj
- model.layers.2.mlp.down_proj
- model.layers.3.mlp.down_proj
- model.layers.4.mlp.down_proj
- model.layers.5.mlp.down_proj
post_oneshot_calibration: True
scheme_overrides:
Embedding:
input_activations: null
Expand All @@ -27,26 +26,4 @@ test_stage:
GPTQModifier:
block_size: 128
sequential_update: False
percdamp: 0.01
targets: [
"model.layers.0",
"model.layers.1",
"model.layers.2",
"model.layers.3",
"model.layers.4",
"model.layers.5"
]
SparseGPTModifier:
sparsity: 0.5
block_size: 128
sequential_update: False
percdamp: 0.01
mask_structure: "0:0"
targets: [
"model.layers.0",
"model.layers.1",
"model.layers.2",
"model.layers.3",
"model.layers.4",
"model.layers.5"
]
percdamp: 0.01
5 changes: 2 additions & 3 deletions tests/sparseml/transformers/obcq/recipes/sparse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ test_stage:
block_size: 128
sequential_update: False
percdamp: 0.01
mask_structure: "0:0"
targets: [
"model.layers.0",
"model.layers.1",
"lm_head"
]
]
mask_structure: "0:0"
4 changes: 0 additions & 4 deletions tests/sparseml/transformers/obcq/test_obcq_sparsity.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ def test_sparsities(self):

model = get_session_model()

lm_head_sparsity = tensor_sparsity(model.lm_head.weight)
assert math.isclose(lm_head_sparsity.item(), self.sparsity, rel_tol=1e-4)
layer_1_sparse = tensor_sparsity(model.model.layers[1].self_attn.k_proj.weight)
assert math.isclose(layer_1_sparse.item(), self.sparsity, rel_tol=1e-4)
layer_2_dense = tensor_sparsity(model.model.layers[2].self_attn.k_proj.weight)
Expand Down Expand Up @@ -118,8 +116,6 @@ def test_sparsities_gpu(self):

model = get_session_model()

lm_head_sparsity = tensor_sparsity(model.lm_head.weight)
assert math.isclose(lm_head_sparsity.item(), self.sparsity, rel_tol=1e-4)
layer_1_sparse = tensor_sparsity(model.model.layers[1].self_attn.k_proj.weight)
assert math.isclose(layer_1_sparse.item(), self.sparsity, rel_tol=1e-4)
layer_2_dense = tensor_sparsity(model.model.layers[2].self_attn.k_proj.weight)
Expand Down

0 comments on commit 4399503

Please sign in to comment.