Skip to content

[Bug] AutoModelForMaskGeneration fails to load facebook/sam-vit-base due to config mismatch #497

@TristanLecourtois

Description

@TristanLecourtois

[Bug] AutoModelForMaskGeneration fails to load facebook/sam-vit-base due to config mismatch

Hi,

I'm trying to run the Jupyter notebook https://github.com/NielsRogge/Transformers-Tutorials/blob/master/Grounding%20DINO/GroundingDINO_with_Segment_Anything.ipynb but I encountered an error when loading the SAM model with AutoModelForMaskGeneration I'm trying to use the model facebook/sam-vit-base in a Python script using:

from transformers import AutoModelForMaskGeneration
model = AutoModelForMaskGeneration.from_pretrained("facebook/sam-vit-base")

But I get the following error:

ValueError: Unrecognized configuration class <class 'transformers.models.sam.configuration_sam.SamConfig'> for this kind of AutoModel: AutoModelForMaskGeneration.
Model type should be one of SamHQConfig.

It seems that facebook/sam-vit-base is not compatible with AutoModelForMaskGeneration, which expects a SamHQConfig.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions