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

[Awq] Add peft support for AWQ #28987

Merged
merged 5 commits into from
Feb 19, 2024
Merged
Changes from 1 commit
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
11 changes: 8 additions & 3 deletions src/transformers/quantizers/quantizer_awq.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import importlib.metadata
from typing import TYPE_CHECKING

from packaging import version

from .base import HfQuantizer


Expand Down Expand Up @@ -95,6 +98,8 @@ def _process_model_after_weight_loading(self, model):
model = fuse_awq_modules(model, self.quantization_config)
model._awq_is_fused = True # TODO: consider storing this flag in model.config instead

model._is_quantized_training_enabled = self.is_trainable
younesbelkada marked this conversation as resolved.
Show resolved Hide resolved

@property
def is_serializable(self):
# AWQ through auto-awq has been always serializable, except if the model is fused.
Expand All @@ -105,6 +110,6 @@ def is_serializable(self):

@property
def is_trainable(self):
# AWQ does not support neither QAT (Quantization Aware Training or PEFT yet.)
# TODO: if this is supported in the future, do a version check here.
return False
# AWQ support PEFT fine-tuning from its 0.2.0 version
younesbelkada marked this conversation as resolved.
Show resolved Hide resolved
MIN_AWQ_VERSION_FOR_PEFT = "0.2.0"
return version.parse(importlib.metadata.version("autoawq")) >= version.parse(MIN_AWQ_VERSION_FOR_PEFT)
Loading