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
dynamo
Commits
e2716073
Unverified
Commit
e2716073
authored
Jun 17, 2025
by
Kris Hung
Committed by
GitHub
Jun 17, 2025
Browse files
fix: Handle model not found error for multimodal example (#1545)
parent
636bac0e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
42 additions
and
2 deletions
+42
-2
examples/multimodal/components/frontend.py
examples/multimodal/components/frontend.py
+12
-1
examples/multimodal/components/video_frontend.py
examples/multimodal/components/video_frontend.py
+12
-1
examples/multimodal/configs/agg-llava.yaml
examples/multimodal/configs/agg-llava.yaml
+3
-0
examples/multimodal/configs/agg-phi3v.yaml
examples/multimodal/configs/agg-phi3v.yaml
+3
-0
examples/multimodal/configs/agg-qwen.yaml
examples/multimodal/configs/agg-qwen.yaml
+3
-0
examples/multimodal/configs/agg_video.yaml
examples/multimodal/configs/agg_video.yaml
+3
-0
examples/multimodal/configs/disagg.yaml
examples/multimodal/configs/disagg.yaml
+3
-0
examples/multimodal/configs/disagg_video.yaml
examples/multimodal/configs/disagg_video.yaml
+3
-0
No files found.
examples/multimodal/components/frontend.py
View file @
e2716073
...
@@ -18,8 +18,9 @@ import logging
...
@@ -18,8 +18,9 @@ import logging
from
components.processor
import
Processor
from
components.processor
import
Processor
from
fastapi
import
FastAPI
from
fastapi
import
FastAPI
from
fastapi.responses
import
StreamingResponse
from
fastapi.responses
import
JSONResponse
,
StreamingResponse
from
utils.protocol
import
MultiModalRequest
from
utils.protocol
import
MultiModalRequest
from
utils.vllm
import
parse_vllm_args
from
dynamo.sdk
import
DYNAMO_IMAGE
,
api
,
depends
,
service
from
dynamo.sdk
import
DYNAMO_IMAGE
,
api
,
depends
,
service
...
@@ -38,8 +39,18 @@ logger = logging.getLogger(__name__)
...
@@ -38,8 +39,18 @@ logger = logging.getLogger(__name__)
class
Frontend
:
class
Frontend
:
processor
=
depends
(
Processor
)
processor
=
depends
(
Processor
)
def
__init__
(
self
):
class_name
=
self
.
__class__
.
__name__
self
.
engine_args
=
parse_vllm_args
(
class_name
,
""
)
@
api
(
name
=
"v1/chat/completions"
)
@
api
(
name
=
"v1/chat/completions"
)
async
def
generate
(
self
,
request
:
MultiModalRequest
):
async
def
generate
(
self
,
request
:
MultiModalRequest
):
if
self
.
engine_args
.
model
!=
request
.
model
:
return
JSONResponse
(
{
"error"
:
f
"Model '
{
request
.
model
}
' not found"
},
status_code
=
404
,
)
async
def
content_generator
():
async
def
content_generator
():
async
for
response
in
self
.
processor
.
generate
(
request
.
model_dump_json
()):
async
for
response
in
self
.
processor
.
generate
(
request
.
model_dump_json
()):
try
:
try
:
...
...
examples/multimodal/components/video_frontend.py
View file @
e2716073
...
@@ -18,8 +18,9 @@ import logging
...
@@ -18,8 +18,9 @@ import logging
from
components.video_processor
import
Processor
from
components.video_processor
import
Processor
from
fastapi
import
FastAPI
from
fastapi
import
FastAPI
from
fastapi.responses
import
StreamingResponse
from
fastapi.responses
import
JSONResponse
,
StreamingResponse
from
utils.protocol
import
MultiModalRequest
from
utils.protocol
import
MultiModalRequest
from
utils.vllm
import
parse_vllm_args
from
dynamo.sdk
import
DYNAMO_IMAGE
,
api
,
depends
,
service
from
dynamo.sdk
import
DYNAMO_IMAGE
,
api
,
depends
,
service
...
@@ -38,8 +39,18 @@ logger = logging.getLogger(__name__)
...
@@ -38,8 +39,18 @@ logger = logging.getLogger(__name__)
class
Frontend
:
class
Frontend
:
processor
=
depends
(
Processor
)
processor
=
depends
(
Processor
)
def
__init__
(
self
):
class_name
=
self
.
__class__
.
__name__
self
.
engine_args
=
parse_vllm_args
(
class_name
,
""
)
@
api
(
name
=
"v1/chat/completions"
)
@
api
(
name
=
"v1/chat/completions"
)
async
def
generate
(
self
,
request
:
MultiModalRequest
):
async
def
generate
(
self
,
request
:
MultiModalRequest
):
if
self
.
engine_args
.
model
!=
request
.
model
:
return
JSONResponse
(
{
"error"
:
f
"Model '
{
request
.
model
}
' not found"
},
status_code
=
404
,
)
async
def
content_generator
():
async
def
content_generator
():
async
for
response
in
self
.
processor
.
generate
(
request
.
model_dump_json
()):
async
for
response
in
self
.
processor
.
generate
(
request
.
model_dump_json
()):
try
:
try
:
...
...
examples/multimodal/configs/agg-llava.yaml
View file @
e2716073
...
@@ -17,6 +17,9 @@ Common:
...
@@ -17,6 +17,9 @@ Common:
block-size
:
64
block-size
:
64
max-model-len
:
4096
max-model-len
:
4096
Frontend
:
common-configs
:
[
model
]
Processor
:
Processor
:
router
:
round-robin
router
:
round-robin
prompt-template
:
"
USER:
<image>
\n
<prompt>
ASSISTANT:"
prompt-template
:
"
USER:
<image>
\n
<prompt>
ASSISTANT:"
...
...
examples/multimodal/configs/agg-phi3v.yaml
View file @
e2716073
...
@@ -18,6 +18,9 @@ Common:
...
@@ -18,6 +18,9 @@ Common:
max-model-len
:
4096
max-model-len
:
4096
trust-remote-code
:
true
trust-remote-code
:
true
Frontend
:
common-configs
:
[
model
]
Processor
:
Processor
:
router
:
round-robin
router
:
round-robin
prompt-template
:
"
<|user|>
\n
<|image_1|>
\n
<prompt><|end|>
\n
<|assistant|>
\n
"
prompt-template
:
"
<|user|>
\n
<|image_1|>
\n
<prompt><|end|>
\n
<|assistant|>
\n
"
...
...
examples/multimodal/configs/agg-qwen.yaml
View file @
e2716073
...
@@ -17,6 +17,9 @@ Common:
...
@@ -17,6 +17,9 @@ Common:
block-size
:
64
block-size
:
64
max-model-len
:
4096
max-model-len
:
4096
Frontend
:
common-configs
:
[
model
]
Processor
:
Processor
:
router
:
round-robin
router
:
round-robin
prompt-template
:
"
<|im_start|>system
\n
You
are
a
helpful
assistant.<|im_end|>
\n
<|im_start|>user
\n
<|vision_start|><|image_pad|><|vision_end|><prompt><|im_end|>
\n
<|im_start|>assistant
\n
"
prompt-template
:
"
<|im_start|>system
\n
You
are
a
helpful
assistant.<|im_end|>
\n
<|im_start|>user
\n
<|vision_start|><|image_pad|><|vision_end|><prompt><|im_end|>
\n
<|im_start|>assistant
\n
"
...
...
examples/multimodal/configs/agg_video.yaml
View file @
e2716073
...
@@ -24,6 +24,9 @@ Common:
...
@@ -24,6 +24,9 @@ Common:
video-token-id
:
32000
video-token-id
:
32000
dummy-tokens-per-frame
:
144
dummy-tokens-per-frame
:
144
Frontend
:
common-configs
:
[
model
]
Processor
:
Processor
:
router
:
round-robin
router
:
round-robin
common-configs
:
[
model
,
block-size
,
max-model-len
]
common-configs
:
[
model
,
block-size
,
max-model-len
]
...
...
examples/multimodal/configs/disagg.yaml
View file @
e2716073
...
@@ -20,6 +20,9 @@ Common:
...
@@ -20,6 +20,9 @@ Common:
num-patches
:
576
num-patches
:
576
kv-transfer-config
:
'
{"kv_connector":"DynamoNixlConnector"}'
kv-transfer-config
:
'
{"kv_connector":"DynamoNixlConnector"}'
Frontend
:
common-configs
:
[
model
]
Processor
:
Processor
:
router
:
round-robin
router
:
round-robin
prompt-template
:
"
USER:
<image>
\n
<prompt>
ASSISTANT:"
prompt-template
:
"
USER:
<image>
\n
<prompt>
ASSISTANT:"
...
...
examples/multimodal/configs/disagg_video.yaml
View file @
e2716073
...
@@ -25,6 +25,9 @@ Common:
...
@@ -25,6 +25,9 @@ Common:
video-token-id
:
32000
video-token-id
:
32000
dummy-tokens-per-frame
:
144
dummy-tokens-per-frame
:
144
Frontend
:
common-configs
:
[
model
]
Processor
:
Processor
:
router
:
round-robin
router
:
round-robin
common-configs
:
[
model
,
block-size
]
common-configs
:
[
model
,
block-size
]
...
...
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