Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4cf0620
support rtn & gptq(draft)
Kaihui-intel Jun 25, 2024
a1d9e10
clean code
Kaihui-intel Jun 25, 2024
b4e93f3
clean gptq
Kaihui-intel Jun 25, 2024
a3a061e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 25, 2024
02ee1f8
del unused line
Kaihui-intel Jun 25, 2024
060ea50
fix load import
Kaihui-intel Jun 26, 2024
1a60731
fix rtn model_path
Kaihui-intel Jun 26, 2024
04e1923
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 26, 2024
8f27d47
update rtn model
Kaihui-intel Jun 26, 2024
263c581
Merge branch 'kaihui/lw' of https://github.com/intel/neural-compresso…
Kaihui-intel Jun 26, 2024
5a3f090
fix clean module
Kaihui-intel Jun 26, 2024
14bd733
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 26, 2024
4ce74db
fix layerwise woq forward
Kaihui-intel Jun 26, 2024
199fe4c
Merge branch 'kaihui/lw' of https://github.com/intel/neural-compresso…
Kaihui-intel Jun 26, 2024
b700d39
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 26, 2024
96d0e05
fix import
Kaihui-intel Jun 26, 2024
4337eac
Merge branch 'kaihui/lw' of https://github.com/intel/neural-compresso…
Kaihui-intel Jun 26, 2024
7b2d326
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 26, 2024
77cde5c
update clean module & add timestep
Jul 3, 2024
6cf8ff3
add numba pack
Jul 11, 2024
0e388c0
mimor fix numba
Jul 11, 2024
b0ccd62
apply mask
Jul 11, 2024
0f7de68
support gptq
Jul 11, 2024
83c6a9b
keep q_model in memory
Jul 12, 2024
483c219
merge master
Jul 12, 2024
c543783
fix master conflict
Jul 12, 2024
159aa34
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 12, 2024
809c0fb
update numba requirements_pt
Jul 12, 2024
308c7fc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 12, 2024
5d80e9b
fix awq config
Jul 12, 2024
c4af344
remove pack_with_reshpe
Jul 12, 2024
e99ee19
recover ar
Jul 12, 2024
1dd01a0
revert eg
Jul 12, 2024
8dbf793
install py 3x deps
chensuyue Jul 12, 2024
0ea77fd
enhance import&add pack ut
Kaihui-intel Jul 16, 2024
eec87ac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 16, 2024
36a4a29
add pack ut file
Kaihui-intel Jul 16, 2024
86008f4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 16, 2024
93a86f2
move load_empty_model to torch.utils
Kaihui-intel Jul 16, 2024
19b1c4d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 16, 2024
f17c640
remove torch import
Kaihui-intel Jul 16, 2024
fa39f6f
fix ut import
Kaihui-intel Jul 16, 2024
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
Prev Previous commit
Next Next commit
merge master
Signed-off-by: sdp <[email protected]>
  • Loading branch information
sdp committed Jul 12, 2024
commit 483c219eb037cd211adb41da14a88a3ff358691f
24 changes: 7 additions & 17 deletions neural_compressor/torch/algorithms/weight_only/rtn.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
# limitations under the License.


import gc
import os
import copy
from collections import OrderedDict

import torch
Expand Down Expand Up @@ -76,6 +75,7 @@ def convert(
use_mse_search=False,
use_layer_wise=False,
model_path="",
quant_lm_head=False,
*args,
**kwargs,
):
Expand Down Expand Up @@ -104,20 +104,12 @@ def convert(
device = get_accelerator(kwargs.pop("device", "auto")).current_device_name()
model_device = get_model_device(model) # return model on the same device

# Put model on device explicitly
# TODO: refine it later, Put module on device one by one instead of the whole model
if not use_layer_wise:
model.to(device)
# for transformers model. If lm_head is tied from embedding, we deepcopy it.
if quant_lm_head and getattr(getattr(model, "config", None), "tie_word_embeddings", False):
for key in model._tied_weights_keys:
weight = get_attr(model, key)
set_attr(model, key, copy.deepcopy(weight))

total_time = 0.0
total_load_time = 0.0
total_save_time = 0.0
total_quant_time = 0.0
total_quant_int_time = 0.0
total_set_module_time = 0.0
save_time = 0.0
layer_time = 0.0
import time
assert isinstance(model, torch.nn.Module), "only support torch module"
if is_transformers_imported():
supported_layers = (torch.nn.Linear, transformers.Conv1D)
Expand Down Expand Up @@ -193,8 +185,6 @@ def convert(
continue
logger.debug(f"RTN quantized module:{name, m}")
logger.debug(log_msg)



if use_layer_wise:
load_module(model, name, model_path, device=device)
Expand Down
1 change: 1 addition & 0 deletions neural_compressor/torch/quantization/algorithm_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def rtn_entry(
{
"use_layer_wise": quant_config.use_layer_wise,
"model_path": quant_config.model_path,
"quant_lm_head": quant_config.quant_lm_head,
}
)
quantizer = get_quantizer(model, quantizer_cls=RTNQuantizer, quant_config=weight_config)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.