Skip to content

Commit

Permalink
support for sparse only ct models
Browse files Browse the repository at this point in the history
  • Loading branch information
dsikka committed Dec 8, 2024
1 parent 6dfc5c9 commit 4820ebe
Showing 1 changed file with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,23 @@ def get_scheme(
# so we do not have to re-write these functions
# need to make accelerate optional in ct to do this

matched_target = find_matched_target(
layer_name=layer_name,
module=layer,
targets=self.target_scheme_map.keys())

scheme_dict = self.target_scheme_map[matched_target]
weight_quant = scheme_dict.get("weights")
input_quant = scheme_dict.get("input_activations")
# Will be empty for models with only sparsity
if self.target_scheme_map:
matched_target = find_matched_target(
layer_name=layer_name,
module=layer,
targets=self.target_scheme_map.keys())

scheme_dict = self.target_scheme_map[matched_target]
weight_quant = scheme_dict.get("weights")
input_quant = scheme_dict.get("input_activations")
elif self.sparsity_scheme_map:
matched_target = find_matched_target(
layer_name=layer_name,
module=layer,
targets=self.sparsity_scheme_map.keys())
weight_quant = None
input_quant = None

sparsity_scheme: Optional[
SparsityCompressionConfig] = self.sparsity_scheme_map.get(
Expand Down

0 comments on commit 4820ebe

Please sign in to comment.