-
Notifications
You must be signed in to change notification settings - Fork 207
Expand file tree
/
Copy path__init__.py
More file actions
133 lines (113 loc) · 4 KB
/
__init__.py
File metadata and controls
133 lines (113 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# 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.
import logging
import warnings
from ..utils.import_utils import (
_openvino_version,
is_diffusers_available,
is_nncf_available,
is_nncf_version,
is_openvino_version,
is_sentence_transformers_available,
)
from .utils import (
OV_DECODER_NAME,
OV_DECODER_WITH_PAST_NAME,
OV_DETOKENIZER_NAME,
OV_ENCODER_NAME,
OV_TOKENIZER_NAME,
OV_XML_FILE_NAME,
)
warnings.simplefilter(action="ignore", category=FutureWarning)
if is_openvino_version("<", "2025.4.0"):
raise ImportError(
"Optimum-intel requires OpenVINO version 2025.4.0 or higher. "
"Please upgrade OpenVINO to version 2025.4 or later. "
f"The current version of OpenVINO is {_openvino_version}."
)
from .configuration import (
OVConfig,
OVDynamicQuantizationConfig,
OVMixedQuantizationConfig,
OVPipelineQuantizationConfig,
OVQuantizationConfig,
OVWeightQuantizationConfig,
)
if is_nncf_available():
logging.disable(logging.INFO)
import nncf
if not is_nncf_version(">=", "2.19.0.dev0"):
raise ImportError(
"NNCF version 2.19.0.dev0 or higher is required to use NNCF-based quantization. "
f"Please upgrade your NNCF installation. The current version of NNCF is {nncf.__version__}."
)
logging.disable(logging.NOTSET)
# Suppress version mismatch logging
nncf.set_log_level(logging.ERROR)
from nncf.torch import patch_torch_operators
nncf.set_log_level(logging.INFO)
patch_torch_operators()
from .quantization import OVCalibrationDataset, OVQuantizer
from .modeling import (
OVModelForAudioClassification,
OVModelForAudioFrameClassification,
OVModelForAudioXVector,
OVModelForCTC,
OVModelForCustomTasks,
OVModelForFeatureExtraction,
OVModelForImageClassification,
OVModelForMaskedLM,
OVModelForQuestionAnswering,
OVModelForSequenceClassification,
OVModelForTokenClassification,
OVModelForZeroShotImageClassification,
)
from .modeling_decoder import OVModelForCausalLM
from .modeling_open_clip import (
OVModelOpenCLIPForZeroShotImageClassification,
OVModelOpenCLIPText,
OVModelOpenCLIPVisual,
)
from .modeling_sam import OVSamModel
from .modeling_seq2seq import OVModelForPix2Struct, OVModelForSeq2SeqLM, OVModelForSpeechSeq2Seq, OVModelForVision2Seq
from .modeling_text2speech import OVModelForTextToSpeechSeq2Seq
from .modeling_visual_language import OVModelForVisualCausalLM
if is_diffusers_available():
from .modeling_diffusion import (
OVDiffusionPipeline,
OVFluxFillPipeline,
OVFluxImg2ImgPipeline,
OVFluxInpaintPipeline,
OVFluxPipeline,
OVLatentConsistencyModelImg2ImgPipeline,
OVLatentConsistencyModelPipeline,
OVLTXPipeline,
OVPipelineForImage2Image,
OVPipelineForInpainting,
OVPipelineForText2Image,
OVPipelineForText2Video,
OVSanaPipeline,
OVSanaSprintPipeline,
OVStableDiffusion3Img2ImgPipeline,
OVStableDiffusion3InpaintPipeline,
OVStableDiffusion3Pipeline,
OVStableDiffusionImg2ImgPipeline,
OVStableDiffusionInpaintPipeline,
OVStableDiffusionPipeline,
OVStableDiffusionXLImg2ImgPipeline,
OVStableDiffusionXLInpaintPipeline,
OVStableDiffusionXLPipeline,
)
if is_sentence_transformers_available():
from .modeling_sentence_transformers import OVSentenceTransformer