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

API change to be compatible to Optimum #421

Merged
merged 5 commits into from
Jan 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: 6 additions & 1 deletion optimum/neuron/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,12 @@ def _from_pretrained(
)

@classmethod
def _from_transformers(
def _from_transformers(cls, *args, **kwargs):
# Deprecate it when optimum uses `_export` as from_pretrained_method in a stable release.
return cls._export(*args, **kwargs)

@classmethod
def _export(
cls,
model_id: str,
config: "PretrainedConfig",
Expand Down
8 changes: 7 additions & 1 deletion optimum/neuron/modeling_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,13 @@ def _create_checkpoint(

@classmethod
@requires_transformers_neuronx
def _from_transformers(
def _from_transformers(cls, *args, **kwargs):
# Deprecate it when optimum uses `_export` as from_pretrained_method in a stable release.
return cls._export(*args, **kwargs)

@classmethod
@requires_transformers_neuronx
def _export(
cls,
model_id: str,
config: "PretrainedConfig",
Expand Down
7 changes: 6 additions & 1 deletion optimum/neuron/modeling_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,12 @@ def _from_pretrained(
)

@classmethod
def _from_transformers(
def _from_transformers(cls, *args, **kwargs):
# Deprecate it when optimum uses `_export` as from_pretrained_method in a stable release.
return cls._export(*args, **kwargs)

@classmethod
def _export(
cls,
model_id: Union[str, Path],
config: Dict[str, Any],
Expand Down
7 changes: 6 additions & 1 deletion optimum/neuron/modeling_seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,12 @@ def _from_pretrained(
)

@classmethod
def _from_transformers(
def _from_transformers(cls, *args, **kwargs):
# Deprecate it when optimum uses `_export` as from_pretrained_method in a stable release.
return cls._export(*args, **kwargs)

@classmethod
def _export(
cls,
model_id: str,
config: "PretrainedConfig",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
INSTALL_REQUIRES = [
"transformers == 4.36.2",
"accelerate == 0.23.0",
"optimum >= 1.14.0",
"optimum >= 1.16.2",
"huggingface_hub >= 0.20.1",
"numpy>=1.22.2, <=1.25.2",
"protobuf<4",
Expand Down
Loading