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

Add ImageProcessorFast to Qwen2.5-VL processor #36164

Merged
merged 21 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from 9 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
5 changes: 5 additions & 0 deletions docs/source/en/model_doc/qwen2_5_vl.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
[[autodoc]] Qwen2_5_VLImageProcessor
- preprocess

## Qwen2_5_VLImageProcessorFast

[[autodoc]] Qwen2_5_VLImageProcessorFast
- preprocess

## Qwen2_5_VLProcessor

[[autodoc]] Qwen2_5_VLProcessor
Expand Down
2 changes: 2 additions & 0 deletions src/transformers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,7 @@
_import_structure["models.llava_next"].append("LlavaNextImageProcessorFast")
_import_structure["models.llava_onevision"].append("LlavaOnevisionImageProcessorFast")
_import_structure["models.pixtral"].append("PixtralImageProcessorFast")
_import_structure["models.qwen2_5_vl"].append("Qwen2_5_VLImageProcessorFast")
_import_structure["models.qwen2_vl"].append("Qwen2VLImageProcessorFast")
_import_structure["models.rt_detr"].append("RTDetrImageProcessorFast")
_import_structure["models.siglip"].append("SiglipImageProcessorFast")
Expand Down Expand Up @@ -6478,6 +6479,7 @@
from .models.llava_next import LlavaNextImageProcessorFast
from .models.llava_onevision import LlavaOnevisionImageProcessorFast
from .models.pixtral import PixtralImageProcessorFast
from .models.qwen2_5_vl import Qwen2_5_VLImageProcessorFast
from .models.qwen2_vl import Qwen2VLImageProcessorFast
from .models.rt_detr import RTDetrImageProcessorFast
from .models.siglip import SiglipImageProcessorFast
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 @@ -127,6 +127,7 @@
("poolformer", ("PoolFormerImageProcessor",)),
("pvt", ("PvtImageProcessor",)),
("pvt_v2", ("PvtImageProcessor",)),
("qwen2_5_vl", ("Qwen2_5_VLImageProcessorFast", "Qwen2_5_VLImageProcessorFast")),
("qwen2_vl", ("Qwen2VLImageProcessor", "Qwen2VLImageProcessorFast")),
("regnet", ("ConvNextImageProcessor", "ConvNextImageProcessorFast")),
("resnet", ("ConvNextImageProcessor", "ConvNextImageProcessorFast")),
Expand Down
1 change: 1 addition & 0 deletions src/transformers/models/qwen2_5_vl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
if TYPE_CHECKING:
from .configuration_qwen2_5_vl import *
from .image_processing_qwen2_5_vl import *
from .image_processing_qwen2_5_vl_fast import *
from .modeling_qwen2_5_vl import *
from .processing_qwen2_5_vl import *
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@
# 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 ...configuration_utils import PretrainedConfig
from ...modeling_rope_utils import rope_config_validation
from ...utils import is_torchvision_available, is_torchvision_v2_available


if is_torchvision_v2_available():
pass
elif is_torchvision_available():
pass


class Qwen2_5_VLVisionConfig(PretrainedConfig):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,18 @@
valid_images,
validate_preprocess_arguments,
)
from ...utils import TensorType, logging
from ...utils import (
TensorType,
is_torchvision_available,
is_torchvision_v2_available,
logging,
)


if is_torchvision_v2_available():
pass
elif is_torchvision_available():
pass


logger = logging.get_logger(__name__)
Expand Down
Loading