Pipeline for Meta's SAM not available yet?

I’m trying to run the code in this tutorial made by HF to run the new Segment Anything model.
Problem is, I can’t actually import it.

Here is the code:

from transformers import pipeline
generator = pipeline("mask-generation", model="facebook/sam-vit-huge", device=0)

And the error:

    642     def __getitem__(self, key):
--> 643         if key in self._extra_content:
    644             return self._extra_content[key]
    645         if key not in self._mapping:

KeyError: 'sam'

Am I missing something here?

You need a source install as this was just added to Transformers.

1 Like

I uninstalled transformers and reinstalled using this command:

!pip install -q git+https://github.com/huggingface/transformers.git

the installed version is: 4.29.0.dev0

However the error remains, is this the right version?

1 Like

Edit: it works now.

1 Like