Skip to content
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
20 changes: 11 additions & 9 deletions src/transformers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@
],
"models.pixtral": [
"PixtralConfig",

],
"models.llava_next": [
"LlavaNextConfig",
Expand Down Expand Up @@ -647,6 +646,7 @@
"models.phi": ["PhiConfig"],
"models.phi3": ["Phi3Config"],
"models.phobert": ["PhobertTokenizer"],
"models.pixtral": ["PixtralConfig", "PixtralProcessor"],
"models.pix2struct": [
"Pix2StructConfig",
"Pix2StructProcessor",
Expand Down Expand Up @@ -1202,6 +1202,7 @@
_import_structure["models.owlv2"].append("Owlv2ImageProcessor")
_import_structure["models.owlvit"].extend(["OwlViTFeatureExtractor", "OwlViTImageProcessor"])
_import_structure["models.perceiver"].extend(["PerceiverFeatureExtractor", "PerceiverImageProcessor"])
_import_structure["models.pixtral"].append("PixtralImageProcessor")
_import_structure["models.pix2struct"].extend(["Pix2StructImageProcessor"])
_import_structure["models.poolformer"].extend(["PoolFormerFeatureExtractor", "PoolFormerImageProcessor"])
_import_structure["models.pvt"].extend(["PvtImageProcessor"])
Expand Down Expand Up @@ -5300,10 +5301,6 @@
LlavaConfig,
LlavaProcessor,
)
from .models.pixtral import (
PixtralConfig,

)
from .models.llava_next import (
LlavaNextConfig,
LlavaNextProcessor,
Expand Down Expand Up @@ -5448,6 +5445,10 @@
Pix2StructTextConfig,
Pix2StructVisionConfig,
)
from .models.pixtral import (
PixtralConfig,
PixtralProcessor,
)
from .models.plbart import PLBartConfig
from .models.poolformer import (
PoolFormerConfig,
Expand Down Expand Up @@ -6023,6 +6024,7 @@
from .models.owlvit import OwlViTFeatureExtractor, OwlViTImageProcessor
from .models.perceiver import PerceiverFeatureExtractor, PerceiverImageProcessor
from .models.pix2struct import Pix2StructImageProcessor
from .models.pixtral import PixtralImageProcessor
from .models.poolformer import (
PoolFormerFeatureExtractor,
PoolFormerImageProcessor,
Expand Down Expand Up @@ -7111,10 +7113,6 @@
LlavaForConditionalGeneration,
LlavaPreTrainedModel,
)
from .models.pixtral import (
PixtralModel,
PixtralPreTrainedModel,
)
from .models.llava_next import (
LlavaNextForConditionalGeneration,
LlavaNextPreTrainedModel,
Expand Down Expand Up @@ -7466,6 +7464,10 @@
Pix2StructTextModel,
Pix2StructVisionModel,
)
from .models.pixtral import (
PixtralModel,
PixtralPreTrainedModel,
)
from .models.plbart import (
PLBartForCausalLM,
PLBartForConditionalGeneration,
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@
lilt,
llama,
llava,
pixtral,
llava_next,
llava_next_video,
llava_onevision,
Expand Down Expand Up @@ -188,6 +187,7 @@
phi3,
phobert,
pix2struct,
pixtral,
plbart,
poolformer,
pop2piano,
Expand Down
4 changes: 2 additions & 2 deletions src/transformers/models/auto/configuration_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@
("lilt", "LiltConfig"),
("llama", "LlamaConfig"),
("llava", "LlavaConfig"),
("pixtral", "PixtralConfig"),
("llava_next", "LlavaNextConfig"),
("llava_next_video", "LlavaNextVideoConfig"),
("llava_onevision", "LlavaOnevisionConfig"),
Expand Down Expand Up @@ -206,6 +205,7 @@
("phi", "PhiConfig"),
("phi3", "Phi3Config"),
("pix2struct", "Pix2StructConfig"),
("pixtral", "PixtralConfig"),
("plbart", "PLBartConfig"),
("poolformer", "PoolFormerConfig"),
("pop2piano", "Pop2PianoConfig"),
Expand Down Expand Up @@ -444,7 +444,6 @@
("llama2", "Llama2"),
("llama3", "Llama3"),
("llava", "LLaVa"),
("pixtral", "Pixtral"),
("llava_next", "LLaVA-NeXT"),
("llava_next_video", "LLaVa-NeXT-Video"),
("llava_onevision", "LLaVA-Onevision"),
Expand Down Expand Up @@ -511,6 +510,7 @@
("phi3", "Phi3"),
("phobert", "PhoBERT"),
("pix2struct", "Pix2Struct"),
("pixtral", "Pixtral"),
("plbart", "PLBart"),
("poolformer", "PoolFormer"),
("pop2piano", "Pop2Piano"),
Expand Down
1 change: 1 addition & 0 deletions src/transformers/models/auto/image_processing_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
("owlvit", ("OwlViTImageProcessor",)),
("perceiver", ("PerceiverImageProcessor",)),
("pix2struct", ("Pix2StructImageProcessor",)),
("pixtral", ("PixtralImageProcessor",)),
("poolformer", ("PoolFormerImageProcessor",)),
("pvt", ("PvtImageProcessor",)),
("pvt_v2", ("PvtImageProcessor",)),
Expand Down
4 changes: 2 additions & 2 deletions src/transformers/models/auto/modeling_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
("persimmon", "PersimmonModel"),
("phi", "PhiModel"),
("phi3", "Phi3Model"),
("pixtral", "PixtralModel"),
("plbart", "PLBartModel"),
("poolformer", "PoolFormerModel"),
("prophetnet", "ProphetNetModel"),
Expand Down Expand Up @@ -277,7 +278,6 @@
("xmod", "XmodModel"),
("yolos", "YolosModel"),
("yoso", "YosoModel"),
("pixtral", "PixtralModel"),
]
)

Expand Down Expand Up @@ -729,12 +729,12 @@
("instructblipvideo", "InstructBlipVideoForConditionalGeneration"),
("kosmos-2", "Kosmos2ForConditionalGeneration"),
("llava", "LlavaForConditionalGeneration"),
("pixtral", "PixtralModel"),
("llava_next", "LlavaNextForConditionalGeneration"),
("llava_next_video", "LlavaNextVideoForConditionalGeneration"),
("llava_onevision", "LlavaOnevisionForConditionalGeneration"),
("paligemma", "PaliGemmaForConditionalGeneration"),
("pix2struct", "Pix2StructForConditionalGeneration"),
("pixtral", "PixtralModel"),
("qwen2_vl", "Qwen2VLForConditionalGeneration"),
("video_llava", "VideoLlavaForConditionalGeneration"),
("vipllava", "VipLlavaForConditionalGeneration"),
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/models/auto/processing_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
("layoutlmv2", "LayoutLMv2Processor"),
("layoutlmv3", "LayoutLMv3Processor"),
("llava", "LlavaProcessor"),
("pixtral", "PixtralProcessor"),
("llava_next", "LlavaNextProcessor"),
("llava_next_video", "LlavaNextVideoProcessor"),
("llava_onevision", "LlavaOnevisionProcessor"),
Expand All @@ -83,6 +82,7 @@
("owlvit", "OwlViTProcessor"),
("paligemma", "PaliGemmaProcessor"),
("pix2struct", "Pix2StructProcessor"),
("pixtral", "PixtralProcessor"),
("pop2piano", "Pop2PianoProcessor"),
("qwen2_audio", "Qwen2AudioProcessor"),
("qwen2_vl", "Qwen2VLProcessor"),
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/models/auto/tokenization_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@
),
),
("llava", ("LlamaTokenizer", "LlamaTokenizerFast" if is_tokenizers_available() else None)),
("pixtral", ("LlamaTokenizer", "LlamaTokenizerFast" if is_tokenizers_available() else None)),
("llava-onevision", ("LlamaTokenizer", "LlamaTokenizerFast" if is_tokenizers_available() else None)),
("llava_next", ("LlamaTokenizer", "LlamaTokenizerFast" if is_tokenizers_available() else None)),
("llava_next_video", ("LlamaTokenizer", "LlamaTokenizerFast" if is_tokenizers_available() else None)),
Expand Down Expand Up @@ -386,6 +385,7 @@
("phi3", ("LlamaTokenizer", "LlamaTokenizerFast" if is_tokenizers_available() else None)),
("phobert", ("PhobertTokenizer", None)),
("pix2struct", ("T5Tokenizer", "T5TokenizerFast" if is_tokenizers_available() else None)),
("pixtral", ("LlamaTokenizer", "LlamaTokenizerFast" if is_tokenizers_available() else None)),
("plbart", ("PLBartTokenizer" if is_sentencepiece_available() else None, None)),
("prophetnet", ("ProphetNetTokenizer", None)),
("qdqbert", ("BertTokenizer", "BertTokenizerFast" if is_tokenizers_available() else None)),
Expand Down
21 changes: 19 additions & 2 deletions src/transformers/models/pixtral/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# limitations under the License.
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


_import_structure = {
"configuration_pixtral": ["PixtralConfig"],
"processing_pixtral": ["PixtralProcessor"],
}


Expand All @@ -32,9 +33,17 @@
"PixtralPreTrainedModel",
]

try:
if not is_vision_available():
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
_import_structure["image_processing_pixtral"] = ["PixtralImageProcessor"]


if TYPE_CHECKING:
from .configuration_pixtral import PixtralConfig
from .configuration_pixtral import PixtralConfig, PixtralProcessor

try:
if not is_torch_available():
Expand All @@ -47,6 +56,14 @@
PixtralPreTrainedModel,
)

try:
if not is_vision_available():
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
pass
else:
from .image_processing_pixtral import PixtralImageProcessor

else:
import sys

Expand Down
1 change: 0 additions & 1 deletion src/transformers/models/pixtral/configuration_pixtral.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING


logger = logging.get_logger(__name__)
Expand Down
Loading
Loading