merve HF staff commited on
Commit
d1bfb9f
1 Parent(s): c380b7f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +34 -4
README.md CHANGED
@@ -3,7 +3,6 @@ tags:
3
  - vision
4
  - image-text-to-text
5
  ---
6
- NOTE: this model can only be used once https://github.com/huggingface/transformers/pull/29012 is merged
7
 
8
  # LLaVa-Next, leveraging [liuhaotian/llava-v1.6-vicuna-13b](https://huggingface.co/liuhaotian/llava-v1.6-vicuna-13b) as LLM
9
 
@@ -13,8 +12,10 @@ Disclaimer: The team releasing LLaVa-NeXT did not write a model card for this mo
13
 
14
  ## Model description
15
 
16
- LLaVa combines a pre-trained large language model with a pre-trained vision encoder for multimodal chatbot use cases.
17
-
 
 
18
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62441d1d9fdefb55a0b7d12c/FPshq08TKYD0e-qwPLDVO.png)
19
 
20
  ## Intended uses & limitations
@@ -24,7 +25,36 @@ other versions on a task that interests you.
24
 
25
  ### How to use
26
 
27
- We refer to the [documentation](https://huggingface.co/transformers/main/model_doc/llava_next.html#).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  ### BibTeX entry and citation info
30
 
 
3
  - vision
4
  - image-text-to-text
5
  ---
 
6
 
7
  # LLaVa-Next, leveraging [liuhaotian/llava-v1.6-vicuna-13b](https://huggingface.co/liuhaotian/llava-v1.6-vicuna-13b) as LLM
8
 
 
12
 
13
  ## Model description
14
 
15
+ LLaVa combines a pre-trained large language model with a pre-trained vision encoder for multimodal chatbot use cases. LLaVA 1.6 improves on LLaVA 1.5 BY:
16
+ - More diverse and high quality data mixture
17
+ - Dynamic high resolution
18
+
19
  ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62441d1d9fdefb55a0b7d12c/FPshq08TKYD0e-qwPLDVO.png)
20
 
21
  ## Intended uses & limitations
 
25
 
26
  ### How to use
27
 
28
+ Here's the prompt template for this model:
29
+ ```
30
+ "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions. USER: <image>\nWhat is shown in this image? ASSISTANT:"
31
+ ```
32
+ You can load and use the model like following:
33
+ ```python
34
+ from transformers import LlavaNextProcessor, LlavaNextForConditionalGeneration
35
+ import torch
36
+ from PIL import Image
37
+ import requests
38
+
39
+ processor = LlavaNextProcessor.from_pretrained("llava-v1.6-vicuna-13b-hf")
40
+
41
+ model = LlavaNextForConditionalGeneration.from_pretrained("llava-v1.6-vicuna-13b-hf", torch_dtype=torch.float16, low_cpu_mem_usage=True)
42
+ model.to("cuda:0")
43
+
44
+ # prepare image and text prompt, using the appropriate prompt template
45
+ url = "https://github.com/haotian-liu/LLaVA/blob/1a91fc274d7c35a9b50b3cb29c4247ae5837ce39/images/llava_v1_5_radar.jpg?raw=true"
46
+ image = Image.open(requests.get(url, stream=True).raw)
47
+ prompt = "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions. USER: <image>\nWhat is shown in this image? ASSISTANT:"
48
+
49
+
50
+ inputs = processor(prompt, image, return_tensors="pt").to("cuda:0")
51
+
52
+ # autoregressively complete prompt
53
+ output = model.generate(**inputs, max_new_tokens=100)
54
+
55
+ print(processor.decode(output[0], skip_special_tokens=True))
56
+ ```
57
+
58
 
59
  ### BibTeX entry and citation info
60