File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/compressed_tensors/quantization Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
from copy import deepcopy
16
- from typing import List , Optional
16
+ from typing import Any , Dict , List , Optional
17
17
18
18
from compressed_tensors .quantization .quant_args import (
19
19
QuantizationArgs ,
20
20
QuantizationStrategy ,
21
21
QuantizationType ,
22
22
)
23
- from pydantic import BaseModel
23
+ from pydantic import BaseModel , model_validator
24
24
25
25
26
26
__all__ = [
@@ -47,6 +47,20 @@ class QuantizationScheme(BaseModel):
47
47
input_activations : Optional [QuantizationArgs ] = None
48
48
output_activations : Optional [QuantizationArgs ] = None
49
49
50
+ @model_validator (mode = "after" )
51
+ def validate_model_after (model : "QuantizationArgs" ) -> Dict [str , Any ]:
52
+ inputs = model .input_activations
53
+ outputs = model .output_activations
54
+
55
+ if inputs is not None :
56
+ if inputs .actorder is not None :
57
+ raise ValueError ("Cannot apply actorder to input activations" )
58
+
59
+ if outputs is not None :
60
+ if outputs .actorder is not None :
61
+ raise ValueError ("Cannot apply actorder to output activations" )
62
+
63
+ return model
50
64
51
65
"""
52
66
Pre-Set Quantization Scheme Args
You can’t perform that action at this time.
0 commit comments