Skip to content

Fix ci10 #1424

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

Merged
merged 2 commits into from
Mar 11, 2025
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
2 changes: 1 addition & 1 deletion tests/models/test_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestOpt(ModelTest):
NATIVE_ARC_CHALLENGE_ACC = 0.1894
NATIVE_ARC_CHALLENGE_ACC_NORM = 0.2278

KERNEL_QUANT = {AUTO_SELECT_BACKEND_ORDER[BACKEND.TORCH]}
KERNEL_QUANT = {AUTO_SELECT_BACKEND_ORDER[BACKEND.TRITON]}
KERNEL_INFERENCE = {AUTO_SELECT_BACKEND_ORDER[BACKEND.MARLIN]}

def test_opt(self):
Expand Down
38 changes: 19 additions & 19 deletions tests/test_bits.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class TestBits(unittest.TestCase):
CUDA_QLINEAR_QUANTIZED_MODEL_ARC_CHALLENGE_EXPECTS = {
2: {'acc,none': 0.2150170648464164, 'acc_norm,none': 0.2696245733788396},
3: {'acc,none': 0.2175767918088737, 'acc_norm,none': 0.26621160409556316},
4: {'acc,none': 0.18515358361774745, 'acc_norm,none': 0.22525597269624573},
8: {'acc,none': 0.3037542662116041, 'acc_norm,none': 0.3319112627986348},
4: {'acc,none': 0.2363, 'acc_norm,none': 0.2517},
8: {'acc,none': 0.3020, 'acc_norm,none': 0.3319112627986348},
}

def calculatorPer(self, filter, value, base_value):
Expand All @@ -86,8 +86,8 @@ def setUpClass(cls):
# cls.backends.extend([BACKEND.EXLLAMA_V2, BACKEND.MARLIN, ])

# TODO Only CUDA Quant Linear is tested for now
cls.pack_backends = [BACKEND.TORCH]
cls.backends = [BACKEND.EXLLAMA_EORA]
cls.pack_backends = [BACKEND.TRITON]
cls.backends = [BACKEND.MARLIN]

def test_bits(self):
# quantize
Expand All @@ -101,20 +101,21 @@ def test_bits(self):
supports_bits = self.QLINEAR_DICT[quant_backend].SUPPORTS_BITS
for bits in supports_bits:
print(f"-----------------------quant backend: {quant_backend}-- bits: {bits} ---------------------")
quantize_config = QuantizeConfig(bits=bits, group_size=128, sym=True, desc_act=False)
quantize_config = QuantizeConfig(bits=bits, group_size=128, sym=True, desc_act=True)
print(f"bits: {bits}, quant_backend: {quant_backend} start quant")
try:
self.quant_and_eval(calibration_dataset, model_id, quant_backend, quantize_config, tokenizer)
except Exception:
error_log=f"bits: {bits}, quant_backend: {quant_backend} An error occurred"
print(error_log)
errors.append(error_log)

traceback.print_exc()

continue

self.assertTrue(len(errors) == 0, '\n'.join(errors))
#try:
self.quant_and_eval(calibration_dataset, model_id, quant_backend, quantize_config, tokenizer)
# except Exception as e:
# raise e
# # error_log=f"bits: {bits}, quant_backend: {quant_backend} An error occurred"
# print(error_log)
# errors.append(error_log)
#
# traceback.print_exc()
#
# continue

# self.assertTrue(len(errors) == 0, '\n'.join(errors))

def quant_and_eval(self, calibration_dataset, model_id, quant_backend, quantize_config, tokenizer):
model = GPTQModel.load(
Expand Down Expand Up @@ -152,8 +153,7 @@ def eval(self, inference_backend, quant_backend, quantize_config, tmp_dir):
tasks=[TASK_NAME],
apply_chat_template=False,
trust_remote_code=False,
batch_size=32,
gen_kwargs="temperature=0.0,top_k=50",
batch_size=4,
random_seed=RAND_SEED,
)
print('--------Eval Result---------')
Expand Down