Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
3167d8da
Unverified
Commit
3167d8da
authored
May 24, 2024
by
bing
Committed by
GitHub
May 24, 2024
Browse files
fix test bug in srt_llava_next_test.py (#470)
parent
0fafc560
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
examples/usage/llava/srt_llava_next_test.py
examples/usage/llava/srt_llava_next_test.py
+3
-3
No files found.
examples/usage/llava/srt_llava_next_test.py
View file @
3167d8da
...
@@ -17,14 +17,14 @@ def image_qa(s, image, question):
...
@@ -17,14 +17,14 @@ def image_qa(s, image, question):
def
single
():
def
single
():
image_url
=
"https://farm4.staticflickr.com/3175/2653711032_804ff86d81_z.jpg"
image_url
=
"https://farm4.staticflickr.com/3175/2653711032_804ff86d81_z.jpg"
pil_image
=
load_image
(
image_url
)
pil_image
,
_
=
load_image
(
image_url
)
state
=
image_qa
.
run
(
image
=
pil_image
,
question
=
"What is this?"
,
max_new_tokens
=
512
)
state
=
image_qa
.
run
(
image
=
pil_image
,
question
=
"What is this?"
,
max_new_tokens
=
512
)
print
(
state
[
"answer"
],
"
\n
"
)
print
(
state
[
"answer"
],
"
\n
"
)
def
stream
():
def
stream
():
image_url
=
"https://farm4.staticflickr.com/3175/2653711032_804ff86d81_z.jpg"
image_url
=
"https://farm4.staticflickr.com/3175/2653711032_804ff86d81_z.jpg"
pil_image
=
load_image
(
image_url
)
pil_image
,
_
=
load_image
(
image_url
)
state
=
image_qa
.
run
(
state
=
image_qa
.
run
(
image
=
pil_image
,
image
=
pil_image
,
question
=
"Please generate short caption for this image."
,
question
=
"Please generate short caption for this image."
,
...
@@ -40,7 +40,7 @@ def stream():
...
@@ -40,7 +40,7 @@ def stream():
def
batch
():
def
batch
():
image_url
=
"https://farm4.staticflickr.com/3175/2653711032_804ff86d81_z.jpg"
image_url
=
"https://farm4.staticflickr.com/3175/2653711032_804ff86d81_z.jpg"
pil_image
=
load_image
(
image_url
)
pil_image
,
_
=
load_image
(
image_url
)
states
=
image_qa
.
run_batch
(
states
=
image_qa
.
run_batch
(
[
[
{
"image"
:
pil_image
,
"question"
:
"What is this?"
},
{
"image"
:
pil_image
,
"question"
:
"What is this?"
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment