llava

Run image-based conversations and visual question answering with the LLaVA model.

Updated May 8, 2026
One-click install
npx skills add https://github.com/superfhp/lumi-agent --skill llava-superfhp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: llava
Source: https://github.com/superfhp/lumi-agent/tree/main/optional-skills/mlops/llava
Command: npx skills add https://github.com/superfhp/lumi-agent --skill llava-superfhp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires transformers, torch, pillow, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

LLaVA addresses the challenge of integrating visual understanding with conversational AI, enabling the creation of chatbots that can engage in image-based conversations and tasks.

Core Features & Use Cases

  • Vision-Language Chatbots: Build chatbots capable of understanding and responding to visual content.
  • Image-based Conversations: Engage in multi-turn conversations using images.
  • Visual Question Answering (VQA): Answer questions based on image content.
  • Instruction Following: Execute visual instructions.
  • Use Case: Develop a chatbot that can analyze medical images and provide insights based on user queries.

Quick Start

Load the LLaVA model and process an image to generate a response:

from llava.model.builder import load_pretrained_model
from llava.mm_utils import get_model_name_from_path, process_images, tokenizer_image_token
from llava.constants import IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_TOKEN
from llava.conversation import conv_templates
from PIL import Image
import torch

# Load model
model_path = "liuhaotian/llava-v1.5-7b"
tokenizer, model, image_processor, context_len = load_pretrained_model(
    model_path=model_path,
    model_base=None,
    model_name=get_model_name_from_path(model_path)
)

# Load image
image = Image.open("image.jpg")
image_tensor = process_images([image], image_processor, model.config)
image_tensor = image_tensor.to(model.device, dtype=torch.float16)

# Create conversation
conv = conv_templates["llava_v1"].copy()
conv.append_message(conv.roles[0], DEFAULT_IMAGE_TOKEN + "\nWhat is in this image?")
conv.append_message(conv.roles[1], None)
prompt = conv.get_prompt()

# Generate response
input_ids = tokenizer_image_token(prompt, tokenizer, IMAGE_TOKEN_INDEX, return_tensors='pt').unsqueeze(0).to(model.device)

with torch.inference_mode():
    output_ids = model.generate(
        input_ids,
        images=image_tensor,
        do_sample=True,
        temperature=0.2,
        max_new_tokens=512
    )

response = tokenizer.decode(output_ids[0], skip_special_tokens=True).strip()
print(response)

Frequently Asked Questions about llava

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a chatbot that can analyze images and answer questions about them?

To build a vision-language chatbot for image analysis, you can use a model like LLaVA to process images and generate conversational responses. This allows your chatbot to perform visual question answering and execute visual instructions based on image content.

Can I use transformers and torch to create a multi-turn image-based conversation?

Yes, you can use transformers and torch to create multi-turn image-based conversations. By leveraging a vision-language model, you can maintain context across a conversation while analyzing and responding to visual content provided by the user.

What dependencies do I need to run a visual question answering model locally?

To run a visual question answering model locally, you need the transformers, torch, and pillow libraries. These dependencies handle the model loading, tensor computations, and image processing required for image-based conversational AI tasks.

Does this approach support analyzing medical images and providing insights based on user queries?

Yes, this approach supports analyzing medical images to provide insights based on user queries. You can develop a specialized chatbot that uses visual instruction following to evaluate medical images and respond with specific observations.

How do I load an image and generate a response using a vision-language model?

To generate a response, load the model using transformers, open your image with pillow, and process it into a tensor. You then append the image token and your question to a conversation template before calling the model's generate function to produce a text response.

What is visual instruction following in the context of conversational AI?

Visual instruction following in conversational AI is the capability of a vision-language model to execute commands based on visual content. It enables chatbots to analyze images and perform specific tasks directed by the user's textual instructions.