diff --git a/optimum/intel/generation/modeling.py b/optimum/intel/generation/modeling.py index 07cb8bc98c..19d5413a3e 100644 --- a/optimum/intel/generation/modeling.py +++ b/optimum/intel/generation/modeling.py @@ -387,7 +387,7 @@ def _from_pretrained( ) @classmethod - def _from_transformers( + def _export( cls, model_id: str, config: PretrainedConfig, @@ -437,3 +437,9 @@ def _from_transformers( model_dtype=torch_dtype, **kwargs, ) + + @classmethod + def _from_transformers(cls, *args, **kwargs): + # TODO : add warning when from_pretrained_method is set to cls._export instead of cls._from_transformers when export=True + # logger.warning("The method `_from_transformers` is deprecated, please use `_export` instead") + return cls._export(*args, **kwargs) \ No newline at end of file diff --git a/optimum/intel/neural_compressor/modeling_base.py b/optimum/intel/neural_compressor/modeling_base.py index 5cd224146a..e71a29d3b2 100644 --- a/optimum/intel/neural_compressor/modeling_base.py +++ b/optimum/intel/neural_compressor/modeling_base.py @@ -219,6 +219,9 @@ def generate(self, *args, **kwargs): ) return self.model.generate(*args, **kwargs) + @classmethod + def _export(cls, *args, **kwargs): + raise NotImplementedError(f"Export not supported for INC model {cls.__name__}") class INCModelForQuestionAnswering(INCModel): auto_model_class = AutoModelForQuestionAnswering