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

Deprecate inc quantized model #624

Merged
merged 2 commits into from
Mar 22, 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
7 changes: 0 additions & 7 deletions optimum/intel/neural_compressor/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
AutoModelForVision2Seq,
GenerationMixin,
PretrainedConfig,
XLNetLMHeadModel,
)
from transformers.modeling_utils import no_init_weights
from transformers.models.auto.auto_factory import _get_model_class
Expand Down Expand Up @@ -84,7 +83,6 @@ def __init__(
self._device = getattr(self.model, "device", None) or torch.device(
"cuda:0" if torch.cuda.is_available() else "cpu"
)

# Registers the INCModelForXXX classes into the transformers AutoModel classes to avoid warnings when creating
# a pipeline https://github.com/huggingface/transformers/blob/cad61b68396a1a387287a8e2e2fef78a25b79383/src/transformers/pipelines/base.py#L863
AutoConfig.register(self.base_model_prefix, AutoConfig)
Expand Down Expand Up @@ -247,11 +245,6 @@ class INCModelForVision2Seq(INCModel):
export_feature = "image-to-text"


class INCModelForXLNetLM(INCModel):
auto_model_class = XLNetLMHeadModel
export_feature = "fill-mask"


class INCModelForCausalLM(INCModel, BaseModelForCausalLM):
auto_model_class = AutoModelForCausalLM
export_feature = "text-generation"
Expand Down
57 changes: 0 additions & 57 deletions optimum/intel/neural_compressor/quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import copy
import inspect
import logging
import warnings
from enum import Enum
from itertools import chain
from pathlib import Path
Expand All @@ -31,18 +30,9 @@
from neural_compressor.quantization import fit
from torch.utils.data import DataLoader, RandomSampler
from transformers import (
AutoModelForCausalLM,
AutoModelForMaskedLM,
AutoModelForMultipleChoice,
AutoModelForQuestionAnswering,
AutoModelForSeq2SeqLM,
AutoModelForSequenceClassification,
AutoModelForTokenClassification,
AutoModelForVision2Seq,
DataCollator,
PretrainedConfig,
PreTrainedModel,
XLNetLMHeadModel,
default_data_collator,
)

Expand Down Expand Up @@ -71,7 +61,6 @@
INCModelForSequenceClassification,
INCModelForTokenClassification,
INCModelForVision2Seq,
INCModelForXLNetLM,
)
from .utils import INCDataLoader, _cfgs_to_fx_cfgs

Expand Down Expand Up @@ -538,49 +527,3 @@ def _apply_quantization_from_config(q_config: Dict, model: torch.nn.Module) -> t
q_model = convert(q_model, mapping=q_mapping, inplace=True)

return q_model


class IncQuantizedModel(INCModel):
@classmethod
def from_pretrained(cls, *args, **kwargs):
warnings.warn(
f"The class `{cls.__name__}` has been depreciated and will be removed in optimum-intel v1.12, please use "
f"`{cls.__name__.replace('IncQuantized', 'INC')}` instead."
)
return super().from_pretrained(*args, **kwargs)


class IncQuantizedModelForQuestionAnswering(IncQuantizedModel):
auto_model_class = AutoModelForQuestionAnswering


class IncQuantizedModelForSequenceClassification(IncQuantizedModel):
auto_model_class = AutoModelForSequenceClassification


class IncQuantizedModelForTokenClassification(IncQuantizedModel):
auto_model_class = AutoModelForTokenClassification


class IncQuantizedModelForMultipleChoice(IncQuantizedModel):
auto_model_class = AutoModelForMultipleChoice


class IncQuantizedModelForSeq2SeqLM(IncQuantizedModel):
auto_model_class = AutoModelForSeq2SeqLM


class IncQuantizedModelForCausalLM(IncQuantizedModel):
auto_model_class = AutoModelForCausalLM


class IncQuantizedModelForMaskedLM(IncQuantizedModel):
auto_model_class = AutoModelForMaskedLM


class IncQuantizedModelForXLNetLM(IncQuantizedModel):
auto_model_class = XLNetLMHeadModel


class IncQuantizedModelForVision2Seq(IncQuantizedModel):
auto_model_class = AutoModelForVision2Seq
Loading