Image-Text-to-Text
Transformers
PyTorch
Safetensors
English
blip-2
visual-question-answering
vision
image-to-text
image-captioning
Instructions to use Salesforce/blip2-opt-2.7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Salesforce/blip2-opt-2.7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Salesforce/blip2-opt-2.7b")# Load model directly from transformers import AutoProcessor, AutoModelForVisualQuestionAnswering processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b") model = AutoModelForVisualQuestionAnswering.from_pretrained("Salesforce/blip2-opt-2.7b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Salesforce/blip2-opt-2.7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Salesforce/blip2-opt-2.7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Salesforce/blip2-opt-2.7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Salesforce/blip2-opt-2.7b
- SGLang
How to use Salesforce/blip2-opt-2.7b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Salesforce/blip2-opt-2.7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Salesforce/blip2-opt-2.7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Salesforce/blip2-opt-2.7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Salesforce/blip2-opt-2.7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Salesforce/blip2-opt-2.7b with Docker Model Runner:
docker model run hf.co/Salesforce/blip2-opt-2.7b
๐ Documentation Enhancement Suggestion
#45 opened 3 months ago
by
CroviaTrust
Multi-image support
2
#43 opened 11 months ago
by
monamp
Seeking resources to perform multimodal semantic search
#41 opened over 1 year ago
by
LukaBloomRox
why max length is -21?????
4
#40 opened over 1 year ago
by
George-H
RuntimeError: shape mismatch:
๐ 8
29
#39 opened over 1 year ago
by
ROSCOSMOS
Smaller BLIP2? 350m went missing
2
#37 opened over 1 year ago
by
xenophundiblum
Is there any param to make the captions more detailed and long?
1
#36 opened over 1 year ago
by
SpiderOP
Is there a param to make sure generate the same caption everytime?
#35 opened almost 2 years ago
by
xsank
Fine tuning blip2 with PPO
#34 opened almost 2 years ago
by
ksooklall
Fine tuning with LORA
4
#33 opened about 2 years ago
by
ksooklall
[AUTOMATED] Model Memory Requirements
๐ 3
#30 opened about 2 years ago
by
model-sizer-bot
NaN loss when finetuning BLIP-2
5
#28 opened about 2 years ago
by
agopalkr
BLIP2 for retrieval
6
#27 opened about 2 years ago
by deleted
8bit model always returns empty string
โ 2
9
#26 opened about 2 years ago
by deleted
Salesforce/blip2-opt-2.7b - Deployment in SageMaker Real time Endpoint - GPU [Solved]
๐ 3
1
#25 opened over 2 years ago
by
Gustavo-Montenegro
Is there any way to Blip2 on Sagemaker
1
#24 opened over 2 years ago
by
NaveenPanuganti
Adding `safetensors` variant of this model
#23 opened over 2 years ago
by
SFconvertbot
Blip and Blip2 comparison?
4
#22 opened over 2 years ago
by
Johanderson
Is there a way to use ViT-L/14 from CLIP?
2
#20 opened over 2 years ago
by
RfKnowledge
How to pass CLIP image embeddings to BLIP2 for captioning?
3
#19 opened over 2 years ago
by
potsu-potsu
[AUTOMATED] Model Memory Requirements
#17 opened over 2 years ago
by
model-sizer-bot
Can this model be used for video captioning?
2
#16 opened over 2 years ago
by
HugTibers
BLIP2 Always Gives `\n` as Output
5
#15 opened over 2 years ago
by
james-passio
Confidence scores for image captioning?
4
#13 opened over 2 years ago
by
acmidev
version misconfiguration for sagemaker
๐ 1
#12 opened almost 3 years ago
by
marcinp
Invoking SageMaker endpoint with BLIP2 model?
๐ 4
#10 opened almost 3 years ago
by
CowboyWay
Question about decoding
1
#9 opened almost 3 years ago
by
babyta
Google Colab (Free) Crash due to not enough memory
1
#8 opened almost 3 years ago
by
masoudkaviani
Train with different language model in BLIP2
#7 opened almost 3 years ago
by
Upyaya
Inference API usage
1
#4 opened about 3 years ago
by
robertwolf
Add zero-shot classification task for BLIP-2
๐ 1
2
#3 opened about 3 years ago
by
youssefadarrab
How to use BLIP 2.0
5
#2 opened about 3 years ago
by
matheusdias
ITM Q-Former
#1 opened over 3 years ago
by
neromule