tico 0.1.0.dev250918__py3-none-any.whl → 0.1.0.dev250921__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tico might be problematic. Click here for more details.
- tico/__init__.py +1 -1
- tico/experimental/quantization/algorithm/gptq/quantizer.py +2 -2
- tico/experimental/quantization/algorithm/smoothquant/quantizer.py +1 -1
- tico/experimental/quantization/config/__init__.py +1 -0
- tico/experimental/quantization/config/base.py +26 -0
- tico/experimental/quantization/config/gptq.py +29 -0
- tico/experimental/quantization/config/pt2e.py +25 -0
- tico/experimental/quantization/{config.py → config/smoothquant.py} +1 -35
- tico/experimental/quantization/ptq/examples/quantize_with_gptq.py +1 -1
- tico/experimental/quantization/public_interface.py +1 -1
- tico/experimental/quantization/quantizer.py +1 -1
- {tico-0.1.0.dev250918.dist-info → tico-0.1.0.dev250921.dist-info}/METADATA +1 -1
- {tico-0.1.0.dev250918.dist-info → tico-0.1.0.dev250921.dist-info}/RECORD +17 -13
- {tico-0.1.0.dev250918.dist-info → tico-0.1.0.dev250921.dist-info}/LICENSE +0 -0
- {tico-0.1.0.dev250918.dist-info → tico-0.1.0.dev250921.dist-info}/WHEEL +0 -0
- {tico-0.1.0.dev250918.dist-info → tico-0.1.0.dev250921.dist-info}/entry_points.txt +0 -0
- {tico-0.1.0.dev250918.dist-info → tico-0.1.0.dev250921.dist-info}/top_level.txt +0 -0
tico/__init__.py
CHANGED
|
@@ -25,7 +25,7 @@ from tico.experimental.quantization.algorithm.gptq.utils import (
|
|
|
25
25
|
gather_single_batch_from_dict,
|
|
26
26
|
gather_single_batch_from_list,
|
|
27
27
|
)
|
|
28
|
-
from tico.experimental.quantization.config import
|
|
28
|
+
from tico.experimental.quantization.config.gptq import GPTQConfig
|
|
29
29
|
from tico.experimental.quantization.quantizer import BaseQuantizer
|
|
30
30
|
|
|
31
31
|
|
|
@@ -44,7 +44,7 @@ class GPTQQuantizer(BaseQuantizer):
|
|
|
44
44
|
3) convert(model) to consume the collected data and apply GPTQ.
|
|
45
45
|
"""
|
|
46
46
|
|
|
47
|
-
def __init__(self, config:
|
|
47
|
+
def __init__(self, config: GPTQConfig):
|
|
48
48
|
super().__init__(config)
|
|
49
49
|
|
|
50
50
|
# cache_args[i] -> list of the i-th positional argument for each batch
|
|
@@ -23,7 +23,7 @@ from tico.experimental.quantization.algorithm.smoothquant.observer import (
|
|
|
23
23
|
from tico.experimental.quantization.algorithm.smoothquant.smooth_quant import (
|
|
24
24
|
apply_smoothing,
|
|
25
25
|
)
|
|
26
|
-
from tico.experimental.quantization.config import SmoothQuantConfig
|
|
26
|
+
from tico.experimental.quantization.config.smoothquant import SmoothQuantConfig
|
|
27
27
|
from tico.experimental.quantization.quantizer import BaseQuantizer
|
|
28
28
|
|
|
29
29
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# DO NOT REMOVE THIS FILE
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from abc import ABC, abstractmethod
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class BaseConfig(ABC):
|
|
19
|
+
"""
|
|
20
|
+
Base configuration class for quantization.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def name(self) -> str:
|
|
26
|
+
pass
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from tico.experimental.quantization.config.base import BaseConfig
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class GPTQConfig(BaseConfig):
|
|
19
|
+
"""
|
|
20
|
+
Configuration for GPTQ.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, verbose: bool = False, show_progress: bool = True):
|
|
24
|
+
self.verbose = verbose
|
|
25
|
+
self.show_progress = show_progress
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def name(self) -> str:
|
|
29
|
+
return "gptq"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from tico.experimental.quantization.config.base import BaseConfig
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PT2EConfig(BaseConfig):
|
|
19
|
+
"""
|
|
20
|
+
Configuration for pytorch 2.0 export quantization.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def name(self) -> str:
|
|
25
|
+
return "pt2e"
|
|
@@ -12,43 +12,9 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
from abc import ABC, abstractmethod
|
|
16
15
|
from typing import Dict, Literal, Optional
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
class BaseConfig(ABC):
|
|
20
|
-
"""
|
|
21
|
-
Base configuration class for quantization.
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
@property
|
|
25
|
-
@abstractmethod
|
|
26
|
-
def name(self) -> str:
|
|
27
|
-
pass
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class PT2EConfig(BaseConfig):
|
|
31
|
-
"""
|
|
32
|
-
Configuration for pytorch 2.0 export quantization.
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
@property
|
|
36
|
-
def name(self) -> str:
|
|
37
|
-
return "pt2e"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class GPTQConfig(BaseConfig):
|
|
41
|
-
"""
|
|
42
|
-
Configuration for GPTQ.
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
def __init__(self, verbose: bool = False, show_progress: bool = True):
|
|
46
|
-
self.verbose = verbose
|
|
47
|
-
self.show_progress = show_progress
|
|
48
|
-
|
|
49
|
-
@property
|
|
50
|
-
def name(self) -> str:
|
|
51
|
-
return "gptq"
|
|
17
|
+
from tico.experimental.quantization.config.base import BaseConfig
|
|
52
18
|
|
|
53
19
|
|
|
54
20
|
class SmoothQuantConfig(BaseConfig):
|
|
@@ -34,7 +34,7 @@ from datasets import load_dataset
|
|
|
34
34
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
35
35
|
|
|
36
36
|
from tico.experimental.quantization import convert, prepare
|
|
37
|
-
from tico.experimental.quantization.config import GPTQConfig
|
|
37
|
+
from tico.experimental.quantization.config.gptq import GPTQConfig
|
|
38
38
|
from tico.experimental.quantization.ptq.observers.affine_base import AffineObserverBase
|
|
39
39
|
from tico.experimental.quantization.ptq.quant_config import QuantConfig
|
|
40
40
|
from tico.experimental.quantization.ptq.utils.introspection import build_fqn_map
|
|
@@ -22,7 +22,7 @@ from tico.experimental.quantization.algorithm.pt2e.quantizer import PT2EQuantize
|
|
|
22
22
|
from tico.experimental.quantization.algorithm.smoothquant.quantizer import (
|
|
23
23
|
SmoothQuantQuantizer,
|
|
24
24
|
)
|
|
25
|
-
from tico.experimental.quantization.config import BaseConfig
|
|
25
|
+
from tico.experimental.quantization.config.base import BaseConfig
|
|
26
26
|
from tico.experimental.quantization.quantizer import BaseQuantizer
|
|
27
27
|
|
|
28
28
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
tico/__init__.py,sha256=
|
|
1
|
+
tico/__init__.py,sha256=SJrnDNsVJlIf-r1ZVzi2Kj_xI68YVwAjm83FWgbiWLE,1883
|
|
2
2
|
tico/pt2_to_circle.py,sha256=gu3MD4Iqc0zMZcCZ2IT8oGbyj21CTSbT3Rgd9s2B_9A,2767
|
|
3
3
|
tico/config/__init__.py,sha256=xZzCXjZ84qE-CsBi-dfaL05bqpQ3stKKfTXhnrJRyVs,142
|
|
4
4
|
tico/config/base.py,sha256=q5xMqGxTUZs4mFqt5c7i_y9U00fYgdMGl9nUqIVMlCo,1248
|
|
@@ -6,14 +6,13 @@ tico/config/factory.py,sha256=il0zqB6Lm5NX2LnG-TUhmiP9vVeZ_3TucJMorVZIodY,1324
|
|
|
6
6
|
tico/config/v1.py,sha256=AVgOck-HxR1R1FZPVjtN5J82hPLJvUxwzbnyWXIQZWE,1237
|
|
7
7
|
tico/experimental/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
|
8
8
|
tico/experimental/quantization/__init__.py,sha256=IaJPZegVJp0P3luutBo907Kp5sOJensE1Mm-XBG_jBs,122
|
|
9
|
-
tico/experimental/quantization/
|
|
10
|
-
tico/experimental/quantization/
|
|
11
|
-
tico/experimental/quantization/quantizer.py,sha256=_2pDtWFKDCuKfYF2bptOwIYsa0VFNFM1ZNgi8_OGvHM,2365
|
|
9
|
+
tico/experimental/quantization/public_interface.py,sha256=y-iwaeuedBvHwTh5hflQg4u2ZCdqf46IlTl9ntHq8pU,4425
|
|
10
|
+
tico/experimental/quantization/quantizer.py,sha256=pDTQGzR-BcQJeGZ7O4cXRQdCme4q_POpxHetwnv0bYg,2370
|
|
12
11
|
tico/experimental/quantization/algorithm/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
|
13
12
|
tico/experimental/quantization/algorithm/gptq/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
|
14
13
|
tico/experimental/quantization/algorithm/gptq/gptq.py,sha256=Qn9b_2ki7B64DcVEY25NMkww3PdZ5EqYQQXfYhNDQ6I,5555
|
|
15
14
|
tico/experimental/quantization/algorithm/gptq/quant.py,sha256=Rl4wAOCmlE0U09BtNCDbccaSNohRHCNLwFi3zCqZfNo,5127
|
|
16
|
-
tico/experimental/quantization/algorithm/gptq/quantizer.py,sha256=
|
|
15
|
+
tico/experimental/quantization/algorithm/gptq/quantizer.py,sha256=ZKeQQWm6eMUyRgntQxVR-QVjxJOc2pW4Dc_mrEPZA64,11686
|
|
17
16
|
tico/experimental/quantization/algorithm/gptq/utils.py,sha256=leGKayf-xbSjVwwAGTA5RsxUKrhDiklOQdlsLifjdrs,1811
|
|
18
17
|
tico/experimental/quantization/algorithm/pt2e/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
|
19
18
|
tico/experimental/quantization/algorithm/pt2e/quantizer.py,sha256=mdTvsG87bo8fu0GaWqSM8iBCs-4f4EfUlVtk-Ko6M34,2546
|
|
@@ -38,8 +37,13 @@ tico/experimental/quantization/algorithm/pt2e/transformation/__init__.py,sha256=
|
|
|
38
37
|
tico/experimental/quantization/algorithm/pt2e/transformation/convert_scalars_to_attrs.py,sha256=Idtoya2RcGKlgUJgC9WqNz0jH3gf6ViuPmsD9ySHbls,2253
|
|
39
38
|
tico/experimental/quantization/algorithm/smoothquant/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
|
40
39
|
tico/experimental/quantization/algorithm/smoothquant/observer.py,sha256=OWBKQ3ox6PqeqgevxOjpXvb7uApoqE4YbUBelGhVSN8,3435
|
|
41
|
-
tico/experimental/quantization/algorithm/smoothquant/quantizer.py,sha256=
|
|
40
|
+
tico/experimental/quantization/algorithm/smoothquant/quantizer.py,sha256=14-QrKAW-Rw6pIbbNaD5eORcH2fqi40-TNFGaWVakIg,3649
|
|
42
41
|
tico/experimental/quantization/algorithm/smoothquant/smooth_quant.py,sha256=fxCy4m-BsSjraciSVPFlPhgsOT46RjrOgczQGb7B9TA,11561
|
|
42
|
+
tico/experimental/quantization/config/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
|
43
|
+
tico/experimental/quantization/config/base.py,sha256=xg_HCDSuMgYvMd6ENZe4Sm2SYJgMaCBj4cmqaz_lhAs,816
|
|
44
|
+
tico/experimental/quantization/config/gptq.py,sha256=IUIEz5bLhsTXqoBCE1rfPec99zsRjwgpDbPW5YJqOPg,973
|
|
45
|
+
tico/experimental/quantization/config/pt2e.py,sha256=9HCrraTGGZeKEN9puKV-ODi7ncV2Wjc3oe_JCO1D_Rs,850
|
|
46
|
+
tico/experimental/quantization/config/smoothquant.py,sha256=fcyhu3YlOTM7fDW9lGTXh-uJOUD6CeykZj7AMCNVbak,1415
|
|
43
47
|
tico/experimental/quantization/evaluation/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
|
44
48
|
tico/experimental/quantization/evaluation/backend.py,sha256=CZL9rZOA0t8cH7PHp6u9l7dGqWNvTj9bKOvwo0PVul0,692
|
|
45
49
|
tico/experimental/quantization/evaluation/evaluate.py,sha256=kfa_GvFaX6DoSTAmuCImMJqF2jgqtnor5UpC7wVmGPI,7877
|
|
@@ -68,7 +72,7 @@ tico/experimental/quantization/ptq/examples/quantize_linear.py,sha256=8zq-ZJDYga
|
|
|
68
72
|
tico/experimental/quantization/ptq/examples/quantize_llama_attn.py,sha256=cVWUSSzaZWFp5QZkNkrlpHU3kXyP84QtnZbahVml_yQ,4329
|
|
69
73
|
tico/experimental/quantization/ptq/examples/quantize_llama_decoder_layer.py,sha256=mBWrjkyEovYQsPC4Rrsri6Pm1rlFmDb3NiP0DQQhFyM,5751
|
|
70
74
|
tico/experimental/quantization/ptq/examples/quantize_llama_mlp.py,sha256=N1qZQgt1S-xZrdv-PW7OfXEcv0gsO2q9faOF4aD-zKo,4147
|
|
71
|
-
tico/experimental/quantization/ptq/examples/quantize_with_gptq.py,sha256=
|
|
75
|
+
tico/experimental/quantization/ptq/examples/quantize_with_gptq.py,sha256=y-SK56j4wL-9j-0jtuOqQUq4CElZtGOETp-Tg4XivUI,10438
|
|
72
76
|
tico/experimental/quantization/ptq/observers/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
|
73
77
|
tico/experimental/quantization/ptq/observers/affine_base.py,sha256=e2Eba64nrxKQyE4F_WJ7WTSsk3xe6bkdGUKaoLFWGFw,4638
|
|
74
78
|
tico/experimental/quantization/ptq/observers/base.py,sha256=Wons1MzpqK1mfcy-ppl-B2Dum0edXg2dWW2Lw3V18tw,3280
|
|
@@ -254,9 +258,9 @@ tico/utils/mx/__init__.py,sha256=IO6FP_xYbGy0dW0HL26GXD3ouxARaxCK7bz9dn4blPQ,26
|
|
|
254
258
|
tico/utils/mx/elemwise_ops.py,sha256=V6glyAHsVR1joqpsgnNytatCD_ew92xNWZ19UFDoMTA,10281
|
|
255
259
|
tico/utils/mx/formats.py,sha256=uzNWyu-1onUlwQfX5cZ6fZSUfHMRqorper7_T1k3jfk,3404
|
|
256
260
|
tico/utils/mx/mx_ops.py,sha256=RcfUTYVi-wilGB2sC35OeARdwDqnixv7dG5iyZ-fQT8,8555
|
|
257
|
-
tico-0.1.0.
|
|
258
|
-
tico-0.1.0.
|
|
259
|
-
tico-0.1.0.
|
|
260
|
-
tico-0.1.0.
|
|
261
|
-
tico-0.1.0.
|
|
262
|
-
tico-0.1.0.
|
|
261
|
+
tico-0.1.0.dev250921.dist-info/LICENSE,sha256=kp4JLII7bzRhPb0CPD5XTDZMh22BQ7h3k3B7t8TiSbw,12644
|
|
262
|
+
tico-0.1.0.dev250921.dist-info/METADATA,sha256=PKokhTsAtNxesEROg_vhfa6pIcl8WyFzlx-5H7RBcGk,8450
|
|
263
|
+
tico-0.1.0.dev250921.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
264
|
+
tico-0.1.0.dev250921.dist-info/entry_points.txt,sha256=kBKYSS_IYrSXmUYevmmepqIVPScq5vF8ulQRu3I_Zf0,59
|
|
265
|
+
tico-0.1.0.dev250921.dist-info/top_level.txt,sha256=oqs7UPoNSKZEwqsX8B-KAWdQwfAa7i60pbxW_Jk7P3w,5
|
|
266
|
+
tico-0.1.0.dev250921.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|