Skip to content
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
7 changes: 3 additions & 4 deletions tests/test_inference_result_xpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ class TestInferenceResultXPU(ModelTest):
(BACKEND.TORCH, DEVICE.XPU, False),
]
)
def testTritonXPU(self, backend, device, template):
def testTorchXPU(self, backend, device, template):
origin_model = GPTQModel.load(
self.NATIVE_MODEL_ID,
quantize_config=QuantizeConfig(),
quantize_config=QuantizeConfig(device=device),
backend=backend,
device=device,
)
tokenizer = self.load_tokenizer(self.NATIVE_MODEL_ID)
calibration_dataset = self.load_dataset(tokenizer, rows=128)
origin_model.quantize(calibration_dataset, backend=BACKEND.TRITON)
origin_model.quantize(calibration_dataset, backend=BACKEND.TORCH)

with tempfile.TemporaryDirectory() as tmpdir:
origin_model.save(tmpdir)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_triton_xpu.py → tests/test_torch_xpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@
from gptqmodel.models._const import DEVICE # noqa: E402


class TestTritonXPU(ModelTest):
class TestTorchXPU(ModelTest):
NATIVE_MODEL_ID = "/monster/data/model/Llama-3.2-1B-Instruct"

def test(self):
origin_model = GPTQModel.load(
self.NATIVE_MODEL_ID,
quantize_config=QuantizeConfig(),
backend=BACKEND.TRITON,
backend=BACKEND.TORCH,
device=DEVICE.XPU,
)
tokenizer = self.load_tokenizer(self.NATIVE_MODEL_ID)
calibration_dataset = self.load_dataset(tokenizer, self.DATASET_SIZE)
origin_model.quantize(calibration_dataset, backend=BACKEND.TRITON)
origin_model.quantize(calibration_dataset, backend=BACKEND.TORCH)
with tempfile.TemporaryDirectory() as tmpdir:
origin_model.save(tmpdir)

model = GPTQModel.load(
tmpdir,
backend=BACKEND.TRITON,
backend=BACKEND.TORCH,
device=DEVICE.XPU,
)
generate_str = tokenizer.decode(model.generate(**tokenizer("The capital of France is is", return_tensors="pt").to(model.device), max_new_tokens=2)[0])
Expand Down