Skip to content
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

add field uri #449

Merged
merged 4 commits into from
Oct 23, 2024
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
18 changes: 17 additions & 1 deletion gptqmodel/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
from ..nn_modules.qlinear.qlinear_qbits import QBitsQuantLinear, qbits_dtype
from ..quantization import GPTQ, QuantizeConfig
from ..quantization.config import (FORMAT, FORMAT_FIELD_JSON, META_FIELD_QUANTIZER, META_QUANTIZER_GPTQMODEL,
MIN_VERSION_WITH_V2, QUANTIZE_BLACK_LIST, AutoRoundQuantizeConfig)
MIN_VERSION_WITH_V2, QUANTIZE_BLACK_LIST, AutoRoundQuantizeConfig, META_FIELD_URI,
META_VALUE_URI, META_FIELD_DAMP_PERCENT, META_FIELD_DAMP_AUTO_INCREMENT)
from ..utils.backend import BACKEND
from ..utils.data import collate_data
from ..utils.device import check_cuda
Expand Down Expand Up @@ -639,6 +640,21 @@ def save_quantized(
version=__version__,
)

self.quantize_config.meta_set(
key=META_FIELD_URI,
value=META_VALUE_URI,
)

self.quantize_config.meta_set(
key=META_FIELD_DAMP_PERCENT,
value=self.quantize_config.damp_percent
)

self.quantize_config.meta_set(
key=META_FIELD_DAMP_AUTO_INCREMENT,
value=self.quantize_config.damp_auto_increment
)

# The config, quantize_config and model may be edited in place in save_quantized.
config = copy.deepcopy(self.model.config)
quantize_config = copy.deepcopy(self.quantize_config)
Expand Down
8 changes: 6 additions & 2 deletions gptqmodel/quantization/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@

META_QUANTIZER_GPTQMODEL = "gptqmodel"

META_FIELD_URI = "uri"
META_VALUE_URI = "https://github.com/modelcloud/gptqmodel"

META_FIELD_DAMP_PERCENT = "damp_percent"
META_FIELD_DAMP_AUTO_INCREMENT = "damp_auto_increment"

# pkg names
PKG_AUTO_ROUND = "auto-round"

Expand Down Expand Up @@ -338,8 +344,6 @@ def to_dict(self):
"static_groups": self.static_groups,
"sym": self.sym,
"lm_head": self.lm_head,
"damp_percent": self.damp_percent,
"damp_auto_increment": self.damp_auto_increment,
"true_sequential": self.true_sequential,
# TODO: deprecate?
"model_name_or_path": self.model_name_or_path,
Expand Down