Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
add q_config[bits] == 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhenzhong1 committed Jan 30, 2024
1 parent 217ee86 commit 0a98285
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions neural_speed/convert/convert_quantized_gptj.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ def convert_q4_bestla_tensor(src_name, dst_name, model, fout, q_config):
int_weight = (int_weight - 8) * 16
gptq_scales = gptq_scales / 16
gptq_zeros = (gptq_zeros - 8) * 16
elif q_config['bits'] == 3:
int_weight = (int_weight - 4) * 32
gptq_scales = gptq_scales / 32
gptq_zeros = (gptq_zeros - 4) * 32
dst = np.zeros((int_weight.shape[0], int_weight.shape[1] * 4), dtype=np.int8)
int_weight = np.ascontiguousarray(int_weight.numpy())
gptq_scales = np.ascontiguousarray((gptq_scales.float()).numpy())
Expand Down

0 comments on commit 0a98285

Please sign in to comment.