Downloads · 30 days
11
5% of all-time downloads
PKU-Alignment/llama3.1-8b-instruct-vision
llama3.1-8b-instruct-vision is a machine learning model from PKU-Alignment. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This repository contains a reproduced version of the LLaVA model from the Llama 3.1-8B-Instruct foundation model using the PKU-Alignment/align-anything library.
Downloads · 30 days
11
5% of all-time downloads
All-time downloads
241
Public
Repo size
33.4 GB
Likes
0
Public
Click a slice to open those files.
.bin16.7 GB · 100%
From the Hugging Face model README
This repository contains a reproduced version of the LLaVA model from the Llama 3.1-8B-Instruct foundation model using the PKU-Alignment/align-anything library.
NOTE: The reproduced version of LLaVA has some different implementation details than the original LLaVA model.
- The reproduced LLaVA uses a different conversation template than the original LLaVA model.
- The initial model weights are loaded from Llama 3.1 8B Instruct model (meta-llama/Llama 3.1-8B-Instruct) rather than lmsys/vicuna-7b-v1.5.
from transformers import (
LlavaForConditionalGeneration,
AutoProcessor,
)
from PIL import Image
path = <path_to_model_dir>
processor = AutoProcessor.from_pretrained(path)
model = LlavaForConditionalGeneration.from_pretrained(path)
prompt = "<|start_header_id|>user<|end_header_id|>: <image> Give an overview of what's in the image.\n<|start_header_id|>assistant<|end_header_id|>: "
image_path = "align-anything/assets/test_image.webp"
image = Image.open(image_path)
inputs = processor(text=prompt, images=image, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=1024)
print(processor.decode(outputs[0], skip_special_tokens=True))