Update README.md
Browse files
README.md
CHANGED
@@ -6,7 +6,7 @@ tags:
|
|
6 |
- 'LLaMA '
|
7 |
- MultiModal
|
8 |
---
|
9 |
-
*This is a Hugging Face friendly Model, the original can be found https://huggingface.co/liuhaotian/llava-llama-2-13b-chat-preview*
|
10 |
<br>
|
11 |
# LLaVA 13B Model Card
|
12 |
|
@@ -50,16 +50,21 @@ usage is as follows
|
|
50 |
|
51 |
```python
|
52 |
from transformers import LlavaProcessor, LlavaLlamaForCausalLM
|
|
|
53 |
PATH_TO_CONVERTED_WEIGHTS = "shauray/Llava-Llama-2-13B-hf"
|
|
|
54 |
model = LlavaLlamaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
|
55 |
processor = LlavaProcessor.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
|
|
|
56 |
url = "https://llava-vl.github.io/static/images/view.jpg"
|
57 |
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
|
58 |
prompt = "How would you best describe the image given?"
|
59 |
inputs = processor(text=prompt, images=image, return_tensors="pt")
|
|
|
60 |
# Generate
|
61 |
generate_ids = model.generate(**inputs, max_length=30)
|
62 |
tokenizer.batch_decode(generate_ids, skip_special_tokens=True)[0]
|
|
|
63 |
"""The photograph shows a wooden dock floating on the water, with mountains in the background. It is an idyllic scene that captures both
|
64 |
nature and human-made structures at their finest moments of beauty or tranquility depending upon one's perspective as they gaze into it"""
|
65 |
```
|
|
|
6 |
- 'LLaMA '
|
7 |
- MultiModal
|
8 |
---
|
9 |
+
*This is a Hugging Face friendly Model, the original can be found at https://huggingface.co/liuhaotian/llava-llama-2-13b-chat-preview*
|
10 |
<br>
|
11 |
# LLaVA 13B Model Card
|
12 |
|
|
|
50 |
|
51 |
```python
|
52 |
from transformers import LlavaProcessor, LlavaLlamaForCausalLM
|
53 |
+
|
54 |
PATH_TO_CONVERTED_WEIGHTS = "shauray/Llava-Llama-2-13B-hf"
|
55 |
+
|
56 |
model = LlavaLlamaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
|
57 |
processor = LlavaProcessor.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
|
58 |
+
|
59 |
url = "https://llava-vl.github.io/static/images/view.jpg"
|
60 |
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
|
61 |
prompt = "How would you best describe the image given?"
|
62 |
inputs = processor(text=prompt, images=image, return_tensors="pt")
|
63 |
+
|
64 |
# Generate
|
65 |
generate_ids = model.generate(**inputs, max_length=30)
|
66 |
tokenizer.batch_decode(generate_ids, skip_special_tokens=True)[0]
|
67 |
+
|
68 |
"""The photograph shows a wooden dock floating on the water, with mountains in the background. It is an idyllic scene that captures both
|
69 |
nature and human-made structures at their finest moments of beauty or tranquility depending upon one's perspective as they gaze into it"""
|
70 |
```
|