मुख्य सामग्री पर जाएँ
Skillpedia
मशीन लर्निंग14k · #11233

blip-2-vision-language

यह क्या करती है

यह स्किल BLIP-2 समझाती है, एक मॉडल जो छवि समझने वाली प्रणाली को भाषा मॉडल से जोड़ता है। यह उन डेवलपर्स के लिए है जिन्हें बिना शुरू से ट्रेनिंग के कैप्शन, दृश्य सवाल-जवाब या छवि-टेक्स्ट मिलान चाहिए।

कब इस्तेमाल करें

  • ✓जब आपको तस्वीरों के एक सेट के लिए स्वाभाविक लगने वाले कैप्शन चाहिए।
  • ✓जब आप छवि में दिख रही चीज़ों के बारे में सवाल पूछना चाहते हैं।
  • ✓जब आप टेक्स्ट विवरण से छवियाँ खोजना या मिलाना चाहते हैं।

Skill का लिंक

https://github.com/Orchestra-Research/AI-Research-SKILLs/blob/main/18-multimodal/blip-2/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/Orchestra-Research/AI-Research-SKILLs/blob/main/18-multimodal/blip-2/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे फ़ोल्डर की हर प्रोडक्ट तस्वीर का छोटा विवरण लिखिए, और बताइए कि उसमें कोई व्यक्ति है या नहीं।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

BLIP-2 इमेज encoder और भाषा मॉडल को फ़्रीज़ रखता है और केवल Q-Former नाम का एक छोटा पुल ट्रेन करता है। आप उसे एक छवि और prompt देते हैं, और वह कैप्शन या जवाब लौटाता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

BLIP-2: Vision-Language Pre-training

Comprehensive guide to using Salesforce's BLIP-2 for vision-language tasks with frozen image encoders and large language models.

When to use BLIP-2

Use BLIP-2 when:

  • Need high-quality image captioning with natural descriptions
  • Building visual question answering (VQA) systems
  • Require zero-shot image-text understanding without task-specific training
  • Want to leverage LLM reasoning for visual tasks
  • Building multimodal conversational AI
  • Need image-text retrieval or matching

Key features:

  • Q-Former architecture: Lightweight query transformer bridges vision and language
  • Frozen backbone efficiency: No need to fine-tune large vision/language models
  • Multiple LLM backends: OPT (2.7B, 6.7B) and FlanT5 (XL, XXL)
  • Zero-shot capabilities: Strong performance without task-specific training
  • Efficient training: Only trains Q-Former (~188M parameters)
  • State-of-the-art results: Beats larger models on VQA benchmarks

Use alternatives instead:

  • LLaVA: For instruction-following multimodal chat
  • InstructBLIP: For improved instruction-following (BLIP-2 successor)
  • GPT-4V/Claude 3: For production multimodal chat (proprietary)
  • CLIP: For simple image-text similarity without generation
  • Flamingo: For few-shot visual learning

Quick start

Installation

# HuggingFace Transformers (recommended)
pip install transformers accelerate torch Pillow

# Or LAVIS library (Salesforce official)
pip install salesforce-lavis

Basic image captioning

import torch
from PIL import Image
from transformers import Blip2Processor, Blip2ForConditionalGeneration

# Load model and processor
processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b")
model = Blip2ForConditionalGeneration.from_pretrained(
    "Salesforce/blip2-opt-2.7b",
    torch_dtype=torch.float16,
    device_map="auto"
)

# Load image
image = Image.open("photo.jpg").convert("RGB")

# Generate caption
inputs = processor(images=image, return_tensors="pt").to("cuda", torch.float16)
generated_ids = model.generate(**inputs, max_new_tokens=50)
caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(caption)

Visual question answering

# Ask a question about the image
question = "What color is the car in this image?"

inputs = processor(images=image, text=question, return_tensors="pt").to("cuda", torch.float16)
generated_ids = model.generate(**inputs, max_new_tokens=50)
answer = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(answer)

Using LAVIS library

import torch
from lavis.models import load_model_and_preprocess
from PIL import Image

# Load model
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model, vis_processors, txt_processors = load_model_and_preprocess(
    name="blip2_opt",
    model_type="pretrain_opt2.7b",
    is_eval=True,
    device=device
)

# Process image
image = Image.open("photo.jpg").convert("RGB")
image = vis_processors["eval"](image).unsqueeze(0).to(device)

# Caption
caption = model.generate({"image": image})
print(caption)

# VQA
question = txt_processors["eval"]("What is in this image?")
answer = model.generate({"image": image, "prompt": question})
print(answer)

Core concepts

Architecture overview

BLIP-2 Architecture:
┌─────────────────────────────────────────────────────────────┐
│                        Q-Former                              │
│  ┌─────────────────────────────────────────────────────┐    │
│  │     Learned Queries (32 queries × 768 dim)          │    │
│  └────────────────────────┬────────────────────────────┘    │
│                           │                                  │
│  ┌────────────────────────▼────────────────────────────┐    │
│  │    Cross-Attention with Image Features               │    │
│  └────────────────────────┬────────────────────────────┘    │
│                           │                                  │
│  ┌────────────────────────▼────────────────────────────┐    │
│  │    Self-Attention Layers (Transformer)               │    │
│  └────────────────────────┬────────────────────────────┘    │
└───────────────────────────┼─────────────────────────────────┘
                            │
┌───────────────────────────▼─────────────────────────────────┐
│  Frozen Vision Encoder    │      Frozen LLM                  │
│  (ViT-G/14 from EVA-CLIP)
अक्सर पूछे जाने वाले सवाल

क्या इसे ट्रेनिंग डेटा चाहिए?

स्किल कहती है कि यह zero-shot काम करता है, इसलिए कैप्शन या VQA के लिए खास ट्रेनिंग नहीं चाहिए।

यह कौन से भाषा मॉडल सपोर्ट करता है?

स्किल OPT के 2.7B और 6.7B, और FlanT5 XL और XXL की सूची देती है।

LLaVA कब इस्तेमाल करना चाहिए?

निर्देशों का पालन करने वाली छवि चैट के लिए स्किल LLaVA सुझाती है।

जानकारी

लेखक का मूल विवरण

Vision-language pre-training framework bridging frozen image encoders and LLMs. Use when you need image captioning, visual question answering, image-text retrieval, or multimodal chat with state-of-the-art zero-shot performance.

repo: Orchestra-Research/AI-Research-SKILLs

लोकप्रियता

GitHub स्टार
14k
रैंकिंग में स्थान
#11233
लाइसेंस
MIT
अपडेट की गई
10/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

autoresearch

14k

यह आपके एजेंट को साहित्य समीक्षा से प्रयोग और लेखन तक पूरे AI रिसर्च प्रोजेक्ट में मार्गदर्शन देती है, परीक्षण और समीक्षा के दोहराने वाले चक्र के साथ।

AI और एजेंटएजेंट

prompt-guard

14k

यह आपके एजेंट को Meta के छोटे classifier से टेक्स्ट को AI ऐप तक पहुँचने से पहले prompt injection और jailbreak कोशिशों के लिए जाँचने देती है।

कोडिंगसिक्योरिटी

pytorch-fsdp2

14k

यह आपके एजेंट को दिखाती है कि ट्रेनिंग स्क्रिप्ट में PyTorch FSDP2 कैसे जोड़ें, ताकि बड़े मॉडल GPU पर बँटें और सही तरीके से सेव हों।

डेटामशीन लर्निंग

ml-training-recipes

14k

यह आपके एजेंट को न्यूरल नेटवर्क के लिए परखे हुए ट्रेनिंग तरीके देती है, जिनमें मॉडल चुनाव, optimizers, learning rates और loss spikes ठीक करना शामिल है।

डेटामशीन लर्निंग

मिलती-जुलती skills