Loading...
Loading...
Compare original and translation side by side
undefinedundefinedundefinedundefinedfrom 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 torchfrom 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 torchundefinedundefined| Model | Parameters | VRAM | Quality |
|---|---|---|---|
| LLaVA-v1.5-7B | 7B | ~14 GB | Good |
| LLaVA-v1.5-13B | 13B | ~28 GB | Better |
| LLaVA-v1.6-34B | 34B | ~70 GB | Best |
undefined| 模型 | 参数规模 | 显存需求 | 质量 |
|---|---|---|---|
| LLaVA-v1.5-7B | 7B | ~14 GB | 良好 |
| LLaVA-v1.5-13B | 13B | ~28 GB | 更优 |
| LLaVA-v1.6-34B | 34B | ~70 GB | 最佳 |
undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedquestion = "Describe this image in detail."
response = ask(model, image, question)question = "Describe this image in detail."
response = ask(model, image, question)question = "How many people are in the image?"
response = ask(model, image, question)question = "How many people are in the image?"
response = ask(model, image, question)question = "List all the objects you can see in this image."
response = ask(model, image, question)question = "List all the objects you can see in this image."
response = ask(model, image, question)question = "What is happening in this scene?"
response = ask(model, image, question)question = "What is happening in this scene?"
response = ask(model, image, question)question = "What is the main topic of this document?"
response = ask(model, document_image, question)question = "What is the main topic of this document?"
response = ask(model, document_image, question)undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined| Model | VRAM (FP16) | VRAM (4-bit) | Speed (tokens/s) |
|---|---|---|---|
| 7B | ~14 GB | ~4 GB | ~20 |
| 13B | ~28 GB | ~8 GB | ~12 |
| 34B | ~70 GB | ~18 GB | ~5 |
| 模型 | FP16显存需求 | 4-bit显存需求 | 生成速度(tokens/秒) |
|---|---|---|---|
| 7B | ~14 GB | ~4 GB | ~20 |
| 13B | ~28 GB | ~8 GB | ~12 |
| 34B | ~70 GB | ~18 GB | ~5 |
from langchain.llms.base import LLM
class LLaVALLM(LLM):
def _call(self, prompt, stop=None):
# Custom LLaVA inference
return response
llm = LLaVALLM()from langchain.llms.base import LLM
class LLaVALLM(LLM):
def _call(self, prompt, stop=None):
# Custom LLaVA inference
return response
llm = LLaVALLM()import gradio as gr
def chat(image, text, history):
response = ask_llava(model, image, text)
return response
demo = gr.ChatInterface(
chat,
additional_inputs=[gr.Image(type="pil")],
title="LLaVA Chat"
)
demo.launch()import gradio as gr
def chat(image, text, history):
response = ask_llava(model, image, text)
return response
demo = gr.ChatInterface(
chat,
additional_inputs=[gr.Image(type="pil")],
title="LLaVA Chat"
)
demo.launch()