多模态开源研究视觉 多模态模型

LLaVA(开源多模态) 1.6

LLaVA系列 · UW-Madison / Microsoft · 2023-04发布

开源支持本地部署多模态国内可直连有免费额度

模型介绍

开源视觉指令跟随模型的开山之作,架构简洁(视觉编码器+LLM),在图像问答、描述与推理上表现出色,生态与衍生模型众多。

模型基础信息

模型系列LLaVA系列
开发机构UW-Madison / Microsoft
发布时间2023-04
参数规模7B / 13B / 34B
上下文窗口8K
模型类型多模态(视觉 + 文本)
中文能力一般
使用方式网页体验 / API调用 / 本地部署

免费额度与收费政策

开源免费

免费规则详情

权重开源免费商用(部分版本遵循 Llama 等基础模型许可)。

收费标准简介

完全免费;仅需硬件成本。

模型能力介绍

✅ 核心优势

  • 最早普及的开源视觉语言模型之�
  • 7B 模型优化后可在消费级显卡运行
  • 社区资料与教程丰富
  • 适合多模态研究入门

⚠️ 短板与局限

  • 推理与复杂指令能力偏弱
  • 长文本与高端场景不如新模型
  • 中文能力一般

🎯 适用场景

  • 图片描述与视觉问答研究
  • 多模态基础研究实验
  • 低成本视觉对话应用
  • 教育入门

模型使用教程

本章节整理 LLaVA(开源多模态) 的在线体验、API调用、本地部署全套入门教程,快速上手使用该模型。

  • LLaVA-1.5/1.6 系列在 7B~34B 尺寸提供图像对话能力。
  • 应用:图像描述、视觉问答、图表理解。
  • 因架构简单,已成为很多多模态微调与研究的基座。

注意:上下文 8K,长文档不适用;运行需要支持视觉编码器推理的环境。

HF_ENDPOINT=https://hf-mirror.com huggingface-cli download liuhaotian/llava-v1.6-vicuna-7b --local-dir ./llava-7b
from transformers import LlavaProcessor, LlavaForConditionalGeneration
import torch
from PIL import Image

model = LlavaForConditionalGeneration.from_pretrained("./llava-7b", device_map="auto")
processor = LlavaProcessor.from_pretrained("./llava-7b")

img = Image.open("photo.png")
prompt = "USER: <image>\n描述这张图片的内容 ASSISTANT:"
inputs = processor(text=prompt, images=img, return_tensors="pt").to("cuda")
out = model.generate(**inputs, max_new_tokens=128)
print(processor.decode(out[0], skip_special_tokens=True))

Ollama:

ollama pull llava
ollama run llava

Transformers:

from transformers import LlavaForConditionalGeneration, AutoProcessor
from PIL import Image

model = LlavaForConditionalGeneration.from_pretrained("llava-hf/llava-1.5-7b-hf", device_map="auto")
processor = AutoProcessor.from_pretrained("llava-hf/llava-1.5-7b-hf")
img = Image.open("demo.png").convert("RGB")
prompt = "USER: <image>\n这张图里有什么? ASSISTANT:"
inputs = processor(text=prompt, images=img, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=128)
print(processor.decode(out[0], skip_special_tokens=True))

💡 使用小技巧

Ollama 直接试:ollama pull llava

新项目建议优先考虑 Qwen2.5-VL 等更新模型。

❓ 常见问题 FAQ

Q1:Llava 全称是什么?

A1:Large Language and Vision Assistant,视觉 + 语言联合模型。

Q2:还适合新项目吗?

A2:作入门学习很好;严肃生产建议选新模型。

访问备注与注意事项