Error in the with mBLIP/Bloomz
I was using this model a couple of days ago, and then suddently gives me an error in my local computer and in colab. I've seen that something was updated maybe some bugs there?
#------------------------------------------------------------------------------------------------------------------
import requests
from PIL import Image
from transformers import BlipProcessor, Blip2ForConditionalGeneration
processor = BlipProcessor.from_pretrained("Gregor/mblip-bloomz-7b")
model = Blip2ForConditionalGeneration.from_pretrained("Gregor/mblip-bloomz-7b")
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
question = "Describe the image in German."
inputs = processor(raw_image, question, return_tensors="pt")
out = model.generate(**inputs)
print(processor.decode(out[0], skip_special_tokens=True))
#------------------------------------------------------------------------------------------------------------------
Error:
#------------------------------------------------------------------------------------------------------------------
warnings.warn(
preprocessor_config.json:β100%
β432/432β[00:00<00:00,β8.52kB/s]
tokenizer_config.json:β100%
β286/286β[00:00<00:00,β5.28kB/s]
tokenizer.json:β100%
β14.5M/14.5Mβ[00:00<00:00,β43.3MB/s]
special_tokens_map.json:β100%
β96.0/96.0β[00:00<00:00,β1.27kB/s]
The tokenizer class you load from this checkpoint is not the same type as the class this function is called from. It may result in unexpected tokenization.
The tokenizer class you load from this checkpoint is 'BloomTokenizer'.
The class this function is called from is 'BertTokenizerFast'.
AttributeError Traceback (most recent call last)
in <cell line: 5>()
3 from transformers import BlipProcessor, Blip2ForConditionalGeneration
4
----> 5 processor = BlipProcessor.from_pretrained("Gregor/mblip-bloomz-7b")
6 model = Blip2ForConditionalGeneration.from_pretrained("Gregor/mblip-bloomz-7b")
7
4 frames
/usr/local/lib/python3.10/dist-packages/transformers/models/bert/tokenization_bert_fast.py in init(self, vocab_file, tokenizer_file, do_lower_case, unk_token, sep_token, pad_token, cls_token, mask_token, tokenize_chinese_chars, strip_accents, **kwargs)
101 )
102
--> 103 normalizer_state = json.loads(self.backend_tokenizer.normalizer.getstate())
104 if (
105 normalizer_state.get("lowercase", do_lower_case) != do_lower_case
AttributeError: 'NoneType' object has no attribute 'getstate'
#------------------------------------------------------------------------------------------------------------------
Can replicate. Using Blip2Processor solves the problem. All other code examples use that one so there was a mistake in the README that I fixed.