Skip to content

Commit

Permalink
copyrights and code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova committed Oct 19, 2023
1 parent e57baac commit fae7802
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 5 deletions.
14 changes: 14 additions & 0 deletions optimum/exporters/openvino/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .__main__ import main_export
from .base import init_model_configs
from .convert import export, export_models, export_pytorch_via_onnx
Expand Down
2 changes: 2 additions & 0 deletions optimum/exporters/openvino/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def _get_submodels_and_export_configs(
model=model, exporter="openvino", task=task
)
onnx_config = onnx_config_constructor(model.config)
if onnx_config.use_past:
onnx_config.use_past_in_inputs = True
models_and_onnx_configs = {"model": (model, onnx_config)}
elif model.config.model_type == "sam":
models_and_onnx_configs = get_sam_models_for_export(model, onnx_config)
Expand Down
13 changes: 13 additions & 0 deletions optimum/exporters/openvino/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from copy import deepcopy
from typing import Callable, Type

Expand Down
14 changes: 14 additions & 0 deletions optimum/exporters/openvino/dummy_input_generators.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Optional, Tuple

from optimum.utils import (
Expand Down
14 changes: 14 additions & 0 deletions optimum/exporters/openvino/normalized_configs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from optimum.utils import NormalizedTextConfig

from .base import register_normalized_config
Expand Down
6 changes: 1 addition & 5 deletions optimum/intel/openvino/modeling_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Dict, Optional, Tuple, Union
from typing import Dict, Optional, Tuple, Union

import numpy as np
import openvino
Expand All @@ -35,10 +35,6 @@
from .utils import OV_XML_FILE_NAME, STR_TO_OV_TYPE


if TYPE_CHECKING:
pass


if is_transformers_version("<", "4.25.0"):
from transformers.generation_utils import GenerationMixin
else:
Expand Down

0 comments on commit fae7802

Please sign in to comment.