Instructions to use Salesforce/blip2-itm-vit-g with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Salesforce/blip2-itm-vit-g with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-image-classification", model="Salesforce/blip2-itm-vit-g") pipe( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png", candidate_labels=["animals", "humans", "landscape"], )# Load model directly from transformers import AutoProcessor, AutoModelForZeroShotImageClassification processor = AutoProcessor.from_pretrained("Salesforce/blip2-itm-vit-g") model = AutoModelForZeroShotImageClassification.from_pretrained("Salesforce/blip2-itm-vit-g") - Notebooks
- Google Colab
- Kaggle
How to use blip2 for image-text Retrieval.
#3
by skycyou - opened
Is there some thing wrong with the model?
When I load Salesforce/blip2-itm-vit-g with Blip2ForImageTextRetrieval, it seems weights were not properly loaded.
Some weights of the model checkpoint at /home/pyr/pretrained_models/Salesforce/blip2-itm-vit-g were not used when initializing Blip2ForImageTextRetrieval: ['cls.predictions.bias', 'cls.predictions.decoder.bias', 'cls.predictions.decoder.weight', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.dense.weight', 'qformer.embeddings.LayerNorm.bias', 'qformer.embeddings.LayerNorm.weight', 'qformer.embeddings.position_embeddings.weight', 'qformer.embeddings.word_embeddings.weight', 'temp', 'text_proj.bias', 'text_proj.weight', 'vision_proj.bias', 'vision_proj.weight']
can you please share a code sample? it should work with the main branch of transformers
can you please share a code sample? it should work with the main branch of transformers
Thanks for your reply. It do work after I reupdate my transformers. I don't know which lib I used has cause the issue above.