Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support woq Autotune #1921

Merged
merged 5 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion neural_compressor/torch/algorithms/weight_only/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,11 @@ def __iter__(self):
if not args:
yield kwargs
elif not kwargs:
yield args
# case: tensor
if len(args) == 1:
yield args[0]
else:
yield args
else:
yield args, kwargs

Expand Down
7 changes: 3 additions & 4 deletions neural_compressor/torch/quantization/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def __init__(
minmax_lr: float = None,
low_gpu_mem_usage: bool = True,
iters: int = 200,
seqlen: int = 2048,
seqlen: int = 512,
n_samples: int = 512,
sampler: str = "rand",
seed: int = 42,
Expand Down Expand Up @@ -1490,8 +1490,7 @@ def get_woq_tuning_config() -> list:
the list of WOQ quant config.
"""
RTN_G32ASYM = RTNConfig(use_sym=False, group_size=32)
AUTO_ROUND_CONFIG = AutoRoundConfig(use_sym=False, group_size=32)
GPTQ_G32ASYM = GPTQConfig(use_sym=False, group_size=32)
GPTQ_G32ASYM_DISABLE_LAST_LINEAR = GPTQConfig(use_sym=False).set_local("*.lm_head", GPTQConfig(dtype="fp32"))
GPTQ_G128ASYM = GPTQConfig(group_size=128, use_sym=False)
AWQ_G32ASYM = AWQConfig(use_sym=False, group_size=32)
return [RTN_G32ASYM, GPTQ_G32ASYM, GPTQ_G32ASYM_DISABLE_LAST_LINEAR, GPTQ_G128ASYM, AWQ_G32ASYM]
return [RTN_G32ASYM, AUTO_ROUND_CONFIG, GPTQ_G32ASYM, AWQ_G32ASYM]
11 changes: 10 additions & 1 deletion test/3x/torch/quantization/weight_only/test_woq_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,16 @@ def test_captured_dataloader_iteration(self):

result = list(dataloader)

assert result == [(1,), (2,), (3,)]
assert result == [1, 2, 3]

# Test case when kwargs is empty
args_list = [(1, 2), (2, 3), (3, 4)]
kwargs_list = [{}, {}, {}]
dataloader = CapturedDataloader(args_list, kwargs_list)

result = list(dataloader)

assert result == [(1, 2), (2, 3), (3, 4)]

# Test case when both args and kwargs are present
args_list = [(1,), (2,), (3,)]
Expand Down
Loading