Skip to content

Commit

Permalink
Fix wrong examples in llava usage. (huggingface#28020)
Browse files Browse the repository at this point in the history
* Fix wrong examples in llava usage.

* Update modeling_llava.py
  • Loading branch information
Lyken17 authored and staghado committed Jan 15, 2024
1 parent aa209ad commit 202176e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/transformers/models/llava/modeling_llava.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ def forward(
>>> url = "https://www.ilankelman.org/stopsigns/australia.jpg"
>>> image = Image.open(requests.get(url, stream=True).raw)
>>> inputs = processor(text=text, images=image, return_tensors="pt")
>>> inputs = processor(text=prompt, images=image, return_tensors="pt")
>>> # Generate
>>> generate_ids = model.generate(**inputs, max_length=30)
>>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
"There seems to be a stop sign"
>>> processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
"\nUSER: What's the content of the image?\nASSISTANT: The image features a stop sign on a street corner"
```"""

output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
Expand Down

0 comments on commit 202176e

Please sign in to comment.