Instructions to use Salesforce/instructblip-vicuna-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Salesforce/instructblip-vicuna-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Salesforce/instructblip-vicuna-7b")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("Salesforce/instructblip-vicuna-7b") model = AutoModelForImageTextToText.from_pretrained("Salesforce/instructblip-vicuna-7b") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Salesforce/instructblip-vicuna-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Salesforce/instructblip-vicuna-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/instructblip-vicuna-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Salesforce/instructblip-vicuna-7b
- SGLang
How to use Salesforce/instructblip-vicuna-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/instructblip-vicuna-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/instructblip-vicuna-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/instructblip-vicuna-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/instructblip-vicuna-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Salesforce/instructblip-vicuna-7b with Docker Model Runner:
docker model run hf.co/Salesforce/instructblip-vicuna-7b
Model weights seem corrupted
There was a new error for the input processing that it cannot process negative and float errors, which I corrected to positive int integers.
Now the model runs without errors but it's giving very weird outputs either without answers, repetitive words or abusive langugages.
Could you check on this issue?
These are some of the answers from VQA v2 dataset:
{"question_id": 546191003, "prompt": "Is that the letter D in the air?", "text": "Is that the letter D in the air? 1080p, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x1080, 1920x108", "model_id": "instructblip"}
{"question_id": 131295000, "prompt": "How many vehicles are in the picture?", "text": "How many vehicles are in the picture?\nI\u2019m sorry, but I don\u2019t see any vehicles in the picture you provided. Could you please clarify what you meant by \u201cvehicles\u201d?", "model_id": "instructblip"}
{"question_id": 524621022, "prompt": "What two animals are photoshopped together?", "text": "What two animals are photoshopped together?\nWhat two animals are photoshopped together to create this image?\nI\u2019m sorry, but I don\u2019t understand what you\u2019re asking. Could you please provide more context or clarify your question?", "model_id": "instructblip"}
{"question_id": 393277009, "prompt": "What color is the building the background?", "text": "What color is the building the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background?\nWhat is the name of the building in the background", "model_id": "instructblip"}