Skip to content
This repository was archived by the owner on Mar 12, 2026. It is now read-only.

Commit a2f96de

Browse files
committed
Update Quantization with related to #15
1 parent b2cf2d6 commit a2f96de

5 files changed

Lines changed: 54 additions & 4 deletions

File tree

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ requires-python = ">=3.12"
77
dependencies = [
88
"crfm-helm>=0.5.6",
99
"dacite>=1.9.2",
10+
"datamodel-code-generator>=0.31.2",
1011
"numpy>=2.3.1",
1112
"openai>=1.93.0",
1213
"pandas>=2.3.0",

‎schema/README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ To generate or update Python types from the JSON schema, you can run the followi
77
```bash
88
datamodel-codegen --input eval.schema.json --output eval_types.py --class-name EvaluationResult --output-model-type pydantic_v2.BaseModel
99
```
10+
or
11+
```bash
12+
uv run datamodel-codegen --input schema/eval.schema.json --input-file-type jsonschema --output schema/eval_types.py --class-name EvaluationResult --output-model-type pydantic_v2.BaseModel
13+
```
14+
from main directory
1015

1116
## Example Data
1217

1318
Please refer to [this file](./eval.example.json) for a minimal data example adhering to the evaluation format schema.
19+
uv run datamodel-codegen --input schema/eval.schema.json --input-file-type jsonschema --output schema/eval_types.py --class-name EvaluationResult --output-model-type pydantic_v2.BaseModel

‎schema/eval.schema.json‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@
126126
"type": "object",
127127
"required": [
128128
"bit_precision",
129-
"method"
129+
"method",
130+
"type"
130131
],
131132
"properties": {
132133
"bit_precision": {
@@ -140,13 +141,29 @@
140141
],
141142
"description": "Quantization bit precision"
142143
},
143-
"method": {
144+
"type": {
144145
"type": "string",
145146
"enum": [
146147
"None",
147148
"dynamic",
148149
"static"
149150
],
151+
"description": "Quantization type"
152+
},
153+
"method": {
154+
"type": "string",
155+
"enum": [
156+
"None",
157+
"AWQ",
158+
"PTQ",
159+
"GPTQ",
160+
"GGUF",
161+
"QAT",
162+
"BitsAndBytes",
163+
"SmoothQuant",
164+
"HQQ",
165+
"Quanto"
166+
],
150167
"description": "Quantization method"
151168
}
152169
}

‎schema/eval_types.py‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: eval.schema.json
3-
# timestamp: 2025-07-06T13:59:25+00:00
3+
# timestamp: 2025-09-04T13:29:15+00:00
44

55
from __future__ import annotations
66

@@ -62,14 +62,28 @@ class BitPrecision(Enum):
6262
float32 = 'float32'
6363

6464

65-
class Method(Enum):
65+
class Type(Enum):
6666
None_ = 'None'
6767
dynamic = 'dynamic'
6868
static = 'static'
6969

7070

71+
class Method(Enum):
72+
None_ = 'None'
73+
AWQ = 'AWQ'
74+
PTQ = 'PTQ'
75+
GPTQ = 'GPTQ'
76+
GGUF = 'GGUF'
77+
QAT = 'QAT'
78+
BitsAndBytes = 'BitsAndBytes'
79+
SmoothQuant = 'SmoothQuant'
80+
HQQ = 'HQQ'
81+
Quanto = 'Quanto'
82+
83+
7184
class Quantization(BaseModel):
7285
bit_precision: BitPrecision = Field(..., description='Quantization bit precision')
86+
type: Type = Field(..., description='Quantization type')
7387
method: Method = Field(..., description='Quantization method')
7488

7589

‎uv.lock‎

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)