RaushanTurganbay HF staff commited on
Commit
3677a7c
1 Parent(s): 1ed7a77

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -1
README.md CHANGED
@@ -2,6 +2,10 @@
2
  tags:
3
  - vision
4
  - image-text-to-text
 
 
 
 
5
  ---
6
 
7
  # LLaVa-Next, leveraging [liuhaotian/llava-v1.6-vicuna-7b](https://huggingface.co/liuhaotian/llava-v1.6-vicuna-7b) as LLM
@@ -44,8 +48,20 @@ model.to("cuda:0")
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
 
 
2
  tags:
3
  - vision
4
  - image-text-to-text
5
+ license: llama2
6
+ language:
7
+ - en
8
+ pipeline_tag: image-text-to-text
9
  ---
10
 
11
  # LLaVa-Next, leveraging [liuhaotian/llava-v1.6-vicuna-7b](https://huggingface.co/liuhaotian/llava-v1.6-vicuna-7b) as LLM
 
48
  # prepare image and text prompt, using the appropriate prompt template
49
  url = "https://github.com/haotian-liu/LLaVA/blob/1a91fc274d7c35a9b50b3cb29c4247ae5837ce39/images/llava_v1_5_radar.jpg?raw=true"
50
  image = Image.open(requests.get(url, stream=True).raw)
 
51
 
52
+ # Define a chat histiry and use `apply_chat_template` to get correctly formatted prompt
53
+ # Each value in "content" has to be a list of dicts with types ("text", "image")
54
+ conversation = [
55
+ {
56
+
57
+ "role": "user",
58
+ "content": [
59
+ {"type": "text", "text": "What is shown in this image?"},
60
+ {"type": "image"},
61
+ ],
62
+ },
63
+ ]
64
+ prompt = processor.apply_chat_template(conversation, add_generation_prompt=True)
65
 
66
  inputs = processor(prompt, image, return_tensors="pt").to("cuda:0")
67