Skip to content

classify_image: TransformersImageClassifierPipeline missing 'framework' attribute #6673

@everettVT

Description

@everettVT

Description

classify_image with provider="transformers" fails with AttributeError: 'TransformersImageClassifierPipeline' object has no attribute 'framework' during postprocess().

MRE

import daft
from daft.functions import classify_image, decode_image

df = (
    daft.from_glob_path("hf://datasets/datasets-examples/doc-image-3/images")
    .with_column("image_bytes", daft.col("path").download())
    .with_column("image_type", decode_image(daft.col("image_bytes")))
    .with_column("image_resized", daft.col("image_type").convert_image("RGB").resize(224, 224))
    .with_column(
        "image_label",
        classify_image(
            daft.col("image_resized"),
            provider="transformers",
            labels=["bulbasaur", "catapie", "voltorb", "electrode"],
            model="openai/clip-vit-base-patch32",
        ),
    )
)

df.show()

Traceback

File ".../daft/ai/transformers/protocols/image_classifier.py", line 64, in postprocess
    if self.framework == "pt" and "siglip" in self.model.config.model_type:
       ^^^^^^^^^^^^^^
AttributeError: 'TransformersImageClassifierPipeline' object has no attribute 'framework'

Environment

  • Daft version: 0.7.6
  • Python: 3.12.12
  • OS: macOS (Apple Silicon)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions