Skip to content

fix pydantic validation errors #1722

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 6 commits into from
Aug 12, 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
10 changes: 5 additions & 5 deletions tests/llmcompressor/modifiers/calibration/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def test_is_quantized_cache_singleton():


def test_update():
nbits = 8
args = QuantizationArgs(nbits=nbits, symmetric=True)
num_bits = 8
args = QuantizationArgs(num_bits=num_bits, symmetric=True)
cache = QuantizedKVParameterCache(args)

max_key_states_val = 1.0
Expand All @@ -62,7 +62,7 @@ def test_update():
layer_idx = 0

cache.update(key_states, value_states, layer_idx)
denom = (2 ** (nbits) - 1) / 2
denom = (2 ** (num_bits) - 1) / 2
expected_k_scale = torch.tensor([max_key_states_val / denom])
expected_v_scale = torch.tensor([max_value_states_val / denom])

Expand All @@ -83,8 +83,8 @@ def test_update():


def test_cache_reset():
nbits = 8
args = QuantizationArgs(nbits=nbits, symmetric=True)
num_bits = 8
args = QuantizationArgs(num_bits=num_bits, symmetric=True)
cache = QuantizedKVParameterCache(args)

max_key_states_val = 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,11 @@ def setUp(self):
"symmetric": False,
"strategy": "token",
"dynamic": True,
"kwargs": {},
},
"weights": {
"num_bits": 4,
"symmetric": True,
"strategy": "channel",
"kwargs": {},
},
}
}
Expand Down
17 changes: 12 additions & 5 deletions tests/llmcompressor/pytorch/utils/test_sparse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import pytest
import torch
from compressed_tensors.quantization import QuantizationArgs, QuantizationScheme
from compressed_tensors.quantization import (
QuantizationArgs,
QuantizationScheme,
QuantizationStrategy,
QuantizationType,
)
from torch.nn import Linear, Module, ReLU

from llmcompressor.pytorch.utils import ModuleSparsificationInfo
Expand All @@ -16,10 +21,12 @@ def __init__(self):
self.fc1.quantization_scheme = QuantizationScheme(
targets=["model.fc1"],
weights=QuantizationArgs(
precision=8,
granularity="per_tensor",
algorithm="gptq",
blocksize=128,
num_bits=8,
type=QuantizationType.INT,
group_size=128,
strategy=QuantizationStrategy.GROUP,
symmetric=True,
dynamic=False,
),
)

Expand Down