Skip to content

Commit

Permalink
Fix get value from qconfig (#3318)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianan-gu authored Oct 21, 2024
1 parent bb76079 commit 1c51f3f
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,15 @@ def from_int4_weight(
lowp_mode = 2
act_quant_mode = 1
cache_weight_for_large_batch = False
if qconfig is not None:
if hasattr(qconfig, "lowp_mode"):
lowp_mode = qconfig.lowp_mode
if hasattr(qconfig, "act_quant_mode"):
act_quant_mode = qconfig.act_quant_mode
if hasattr(qconfig, "cache_weight_for_large_batch"):
if qconfig is not None and hasattr(qconfig, "global_qconfig"):
if hasattr(qconfig.global_qconfig, "lowp_mode"):
lowp_mode = qconfig.global_qconfig.lowp_mode
if hasattr(qconfig.global_qconfig, "act_quant_mode"):
act_quant_mode = qconfig.global_qconfig.act_quant_mode
if hasattr(qconfig.global_qconfig, "cache_weight_for_large_batch"):
cache_weight_for_large_batch = (
qconfig.cache_weight_for_large_batch and lowp_mode == 2
qconfig.global_qconfig.cache_weight_for_large_batch
and lowp_mode in (2, 3)
)

w_dtype = qweight.dtype
Expand Down

0 comments on commit 1c51f3f

Please sign in to comment.