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-6.7b-coco with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Salesforce/blip2-opt-6.7b-coco with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Salesforce/blip2-opt-6.7b-coco")# Load model directly from transformers import AutoProcessor, AutoModelForVisualQuestionAnswering processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-6.7b-coco") model = AutoModelForVisualQuestionAnswering.from_pretrained("Salesforce/blip2-opt-6.7b-coco") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Salesforce/blip2-opt-6.7b-coco with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Salesforce/blip2-opt-6.7b-coco" # 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-6.7b-coco", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Salesforce/blip2-opt-6.7b-coco
- SGLang
How to use Salesforce/blip2-opt-6.7b-coco 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-6.7b-coco" \ --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-6.7b-coco", "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-6.7b-coco" \ --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-6.7b-coco", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Salesforce/blip2-opt-6.7b-coco with Docker Model Runner:
docker model run hf.co/Salesforce/blip2-opt-6.7b-coco
Adding `safetensors` variant of this model
#2
by SFconvertbot - opened
model-00001-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4667d4d1adb58fb7915e8e5b39788e86c7b120edacfd98fc7bd089cccf695378
|
| 3 |
+
size 9801434496
|
model-00002-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3ecfea6585d67dc28b3cbf6901425df152eee9f8dcd0192be4dcc7a63740cd24
|
| 3 |
+
size 9934743016
|
model-00003-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:806fd6ee3d14ceb11d34c5adf83a7313143c34601889af6ad9c4ab8813aa3887
|
| 3 |
+
size 9934793088
|
model-00004-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:54e48b80b328439e0e793252e715d1a5be5323a40b9cc6dc1bdbef8dc9e92352
|
| 3 |
+
size 2166164448
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|