Skip to content

Commit

Permalink
fix export
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed Jan 9, 2024
1 parent c64025d commit b15b251
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion optimum/intel/generation/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def _from_pretrained(
)

@classmethod
def _from_transformers(
def _export(
cls,
model_id: str,
config: PretrainedConfig,
Expand Down Expand Up @@ -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)
3 changes: 3 additions & 0 deletions optimum/intel/neural_compressor/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b15b251

Please sign in to comment.