Feature Extraction pipeline for images
I’ve followed the tutorials as best I can for Feature Extraction of text, and that pipeline seems to work really well. The code is in the multimodal section of the pipeline documentation, but I can’t see what kind of input the model is expecting for an image. The filepath and a PIL image both have given errors, though the PIL version seems to work better than the filepath.My current code is below:from transformers import pipelineimport torchfrom PIL import Imageextractor = pipeline(model=“google/vit-base-patch16-224”, task=“feature-extraction”,device=0)img = Image.open(“0531d216-4a12-4836-8389-efbbfac21a2b.png”)result = extractor(inputs=img, return_tensors=True)print(result.shape)This gives an error:Cell In[18], line 75 extractor = pipeline(model=“google/vit-base-patch16-224”, task=“feature-extraction”,device=0)6 img = Image.open(“0531d216-4a12-4836-8389-efbbfac21a2b.png”)----> 7 result = extractor(inputs=img, return_tensors=True)8 result.shape  # This is a tensor of shape [1, sequence_lenth, hidden_dimension] representing the input string.File ~/.local/lib/python3.10/site-packages/transformers/pipelines/feature_extraction.py:107, in FeatureExtractionPipeline.call(self, *args, **kwargs)97 defcall(self, *args, **kwargs):98     “”"99     Extract the features of the input(s).100(…)105         A nested list offloat: The features computed by the model.106     “”"→ 107     return super().call(*args, **kwargs)File ~/.local/lib/python3.10/site-packages/transformers/pipelines/base.py:1122, in Pipeline.call(self, inputs, num_workers, batch_size, *args, **kwargs)1114     return next(1115         iter(1116             self.get_iterator((…)1119         )1120     )1121 else:→ 1122     return self.run_single(inputs, preprocess_params, forward_params, postprocess_params)File ~/.local/lib/python3.10/site-packages/transformers/pipelines/base.py:1128, in Pipeline.run_single(self, inputs, preprocess_params, forward_params, postprocess_params)1127 def run_single(self, inputs, preprocess_params, forward_params, postprocess_params):→ 1128     model_inputs = self.preprocess(inputs, **preprocess_params)1129     model_outputs = self.forward(model_inputs, **forward_params)1130     outputs = self.postprocess(model_outputs, **postprocess_params)File ~/.local/lib/python3.10/site-packages/transformers/pipelines/feature_extraction.py:81, in FeatureExtractionPipeline.preprocess(self, inputs, **tokenize_kwargs)79 def preprocess(self, inputs, **tokenize_kwargs) → Dict[str, GenericTensor]:80     return_tensors = self.framework—> 81     model_inputs = self.tokenizer(inputs, return_tensors=return_tensors, **tokenize_kwargs)82     return model_inputsTypeError: ‘NoneType’ object is not callableI think that’s referring to the tokenizer - which I’ve not currently set, but they all seem to be text tokenizers? what am I doing wrong here?