🚀 InstructBLIP模型
InstructBLIP模型使用Vicuna - 13b作為語言模型。InstructBLIP由Dai等人在論文InstructBLIP: Towards General - purpose Vision - Language Models with Instruction Tuning中提出。
聲明:發佈InstructBLIP的團隊並未為此模型撰寫模型卡片,此模型卡片由Hugging Face團隊撰寫。
🚀 快速開始
模型描述
InstructBLIP是BLIP - 2的視覺指令微調版本。詳情請參考相關論文。

預期用途和限制
使用方法如下:
from transformers import InstructBlipProcessor, InstructBlipForConditionalGeneration
import torch
from PIL import Image
import requests
model = InstructBlipForConditionalGeneration.from_pretrained("Salesforce/instructblip-vicuna-13b")
processor = InstructBlipProcessor.from_pretrained("Salesforce/instructblip-vicuna-13b")
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)
url = "https://raw.githubusercontent.com/salesforce/LAVIS/main/docs/_static/Confusing-Pictures.jpg"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
prompt = "What is unusual about this image?"
inputs = processor(images=image, text=prompt, return_tensors="pt").to(device)
outputs = model.generate(
**inputs,
do_sample=False,
num_beams=5,
max_length=256,
min_length=1,
top_p=0.9,
repetition_penalty=1.5,
length_penalty=1.0,
temperature=1,
)
generated_text = processor.batch_decode(outputs, skip_special_tokens=True)[0].strip()
print(generated_text)
如何使用
有關代碼示例,請參考文檔。
🔧 技術細節
倫理考量
此版本僅用於支持學術論文的研究目的。我們的模型、數據集和代碼並非專門為所有下游用途而設計或評估。我們強烈建議用戶在部署此模型之前,評估並解決與準確性、安全性和公平性相關的潛在問題。我們鼓勵用戶考慮人工智能的常見侷限性,遵守適用法律,並在選擇用例時採用最佳實踐,特別是在錯誤或濫用可能會對人們的生活、權利或安全產生重大影響的高風險場景中。有關用例的進一步指導,請參考我們的使用條款和人工智能使用條款。
📄 許可證
其他許可證。
屬性 |
詳情 |
模型類型 |
InstructBLIP模型使用Vicuna - 13b作為語言模型,是BLIP - 2的視覺指令微調版本 |
訓練數據 |
文檔未提及 |