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

Fix transformers v4.42.0 compatibility #793

Merged
merged 18 commits into from
Jul 5, 2024
2 changes: 1 addition & 1 deletion .github/workflows/test_openvino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.8", "3.12"]
transformers-version: ["4.36.0", "4.41.*"]
transformers-version: ["4.36.0", "4.42.*"]
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
Expand Down
1 change: 1 addition & 0 deletions optimum/intel/generation/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class BaseModelForCausalLM(OptimizedModel, GenerationMixin):
export_feature = "text-generation"
main_input_name = "input_ids"
base_model_prefix = "torch_script_model"
_supports_cache_class = False

def __init__(
self,
Expand Down
1 change: 1 addition & 0 deletions optimum/intel/ipex/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class IPEXModel(OptimizedModel):
base_model_prefix = "ipex_model"
main_input_name = "input_ids"
output_name = "last_hidden_state"
_supports_cache_class = False

def __init__(
self,
Expand Down
1 change: 1 addition & 0 deletions optimum/intel/neural_compressor/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class INCModel(OptimizedModel):
auto_model_class = AutoModel
export_feature = "feature-extraction"
base_model_prefix = "inc_model"
_supports_cache_class = False

def __init__(
self,
Expand Down
2 changes: 2 additions & 0 deletions optimum/intel/neural_compressor/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ def _inner_training_loop(
def save_model(
self,
output_dir: Optional[str] = None,
_internal_call: bool = False,
Copy link
Collaborator Author

@echarlaix echarlaix Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

save_onnx_model: bool = False,
):
"""
Expand All @@ -695,6 +696,7 @@ def save_model(
output_dir=output_dir,
save_onnx_model=save_onnx_model,
)
# TODO: push to hub if self.args.push_to_hub and not _internal_call

def _save(
self,
Expand Down
1 change: 1 addition & 0 deletions optimum/intel/openvino/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
class OVBaseModel(OptimizedModel):
auto_model_class = None
export_feature = None
_supports_cache_class = False

def __init__(
self,
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

INSTALL_REQUIRE = [
"torch>=1.11",
"transformers>=4.36.0,<4.42.0",
"optimum~=1.20",
"transformers>=4.36.0,<4.43.0",
"optimum @ git+https://github.com/huggingface/optimum.git@fix-sentence-trfs",
"datasets>=1.4.0",
"sentencepiece",
"setuptools",
Expand Down
Loading