Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
inference: false
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
tags:
|
6 |
+
- 'LLaMA '
|
7 |
+
- MultiModal
|
8 |
+
---
|
9 |
+
<br>
|
10 |
+
<br>
|
11 |
+
|
12 |
+
*Copied and modified from https://huggingface.co/liuhaotian/llava-llama-2-13b-chat-lightning-preview*
|
13 |
+
|
14 |
+
# LLaVA Model Card
|
15 |
+
|
16 |
+
## Model details
|
17 |
+
|
18 |
+
**Model type:**
|
19 |
+
LLaVA is an open-source chatbot trained by fine-tuning LLaMA/Vicuna on GPT-generated multimodal instruction-following data.
|
20 |
+
It is an auto-regressive language model, based on the transformer architecture.
|
21 |
+
|
22 |
+
**Model date:**
|
23 |
+
LLaVA-LLaMA-2-13B-Chat-Preview was trained in July 2023.
|
24 |
+
|
25 |
+
**Paper or resources for more information:**
|
26 |
+
https://llava-vl.github.io/
|
27 |
+
|
28 |
+
## License
|
29 |
+
Llama 2 is licensed under the LLAMA 2 Community License,
|
30 |
+
Copyright (c) Meta Platforms, Inc. All Rights Reserved.
|
31 |
+
|
32 |
+
**Where to send questions or comments about the model:**
|
33 |
+
https://github.com/haotian-liu/LLaVA/issues
|
34 |
+
|
35 |
+
## Intended use
|
36 |
+
**Primary intended uses:**
|
37 |
+
The primary use of LLaVA is research on large multimodal models and chatbots.
|
38 |
+
|
39 |
+
**Primary intended users:**
|
40 |
+
The primary intended users of the model are researchers and hobbyists in computer vision, natural language processing, machine learning, and artificial intelligence.
|
41 |
+
|
42 |
+
## Training dataset
|
43 |
+
- 558K filtered image-text pairs from LAION/CC/SBU, captioned by BLIP.
|
44 |
+
- 80K GPT-generated multimodal instruction-following data.
|
45 |
+
|
46 |
+
## Evaluation dataset
|
47 |
+
A preliminary evaluation of the model quality is conducted by creating a set of 90 visual reasoning questions from 30 unique images randomly sampled from COCO val 2014 and each is associated with three types of questions: conversational, detailed description, and complex reasoning. We utilize GPT-4 to judge the model outputs.
|
48 |
+
We also evaluate our model on the ScienceQA dataset. Our synergy with GPT-4 sets a new state-of-the-art on the dataset.
|
49 |
+
See https://llava-vl.github.io/ for more details.
|
50 |
+
|
51 |
+
## Usage
|
52 |
+
usage is as follows
|
53 |
+
|
54 |
+
```python
|
55 |
+
from transformers import LlavaProcessor, LlavaLlamaForCausalLM
|
56 |
+
|
57 |
+
PATH_TO_CONVERTED_WEIGHTS = "shauray/Llava-Llama-2-7B-hf"
|
58 |
+
|
59 |
+
model = LlavaLlamaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
|
60 |
+
processor = LlavaProcessor.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
|
61 |
+
|
62 |
+
url = "https://llava-vl.github.io/static/images/view.jpg"
|
63 |
+
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
|
64 |
+
prompt = "How would you best describe the image given?"
|
65 |
+
|
66 |
+
inputs = processor(text=prompt, images=image, return_tensors="pt")
|
67 |
+
# Generate
|
68 |
+
generate_ids = model.generate(**inputs, max_length=30)
|
69 |
+
tokenizer.batch_decode(generate_ids, skip_special_tokens=True)[0]
|
70 |
+
"""The photograph shows a wooden dock floating on the water, with mountains in the background. It is an idyllic scene that captures both
|
71 |
+
nature and human-made structures at their finest moments of beauty or tranquility depending upon one's perspective as they gaze into it"""
|
72 |
+
```
|