Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
a6073124
Unverified
Commit
a6073124
authored
Dec 28, 2024
by
Chen Zhang
Committed by
GitHub
Dec 28, 2024
Browse files
[Doc] Update mllama example based on official doc (#11567)
Signed-off-by:
Chen Zhang
<
zhangch99@outlook.com
>
parent
ac797994
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
examples/offline_inference_vision_language.py
examples/offline_inference_vision_language.py
+14
-1
No files found.
examples/offline_inference_vision_language.py
View file @
a6073124
...
...
@@ -308,7 +308,20 @@ def run_mllama(question: str, modality: str):
disable_mm_preprocessor_cache
=
args
.
disable_mm_preprocessor_cache
,
)
prompt
=
f
"<|image|><|begin_of_text|>
{
question
}
"
tokenizer
=
AutoTokenizer
.
from_pretrained
(
model_name
)
messages
=
[{
"role"
:
"user"
,
"content"
:
[{
"type"
:
"image"
},
{
"type"
:
"text"
,
"text"
:
f
"
{
question
}
"
}]
}]
prompt
=
tokenizer
.
apply_chat_template
(
messages
,
add_generation_prompt
=
True
,
tokenize
=
False
)
stop_token_ids
=
None
return
llm
,
prompt
,
stop_token_ids
...
...
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