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
c47aafa3
Unverified
Commit
c47aafa3
authored
Mar 19, 2025
by
Nick Hill
Committed by
GitHub
Mar 20, 2025
Browse files
[BugFix] Lazily import XgrammarBackend to avoid early cuda init (#15171)
Signed-off-by:
Nick Hill
<
nhill@redhat.com
>
parent
cfbca8a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
vllm/v1/structured_output/__init__.py
vllm/v1/structured_output/__init__.py
+3
-1
No files found.
vllm/v1/structured_output/__init__.py
View file @
c47aafa3
...
...
@@ -9,7 +9,6 @@ from vllm.config import VllmConfig
from
vllm.logger
import
init_logger
from
vllm.v1.structured_output.backend_types
import
(
StructuredOutputBackend
,
StructuredOutputGrammar
)
from
vllm.v1.structured_output.backend_xgrammar
import
XgrammarBackend
if
TYPE_CHECKING
:
import
numpy
as
np
...
...
@@ -47,6 +46,9 @@ class StructuredOutputManager:
if
self
.
backend
is
None
:
backend_name
=
request
.
sampling_params
.
guided_decoding
.
backend_name
if
backend_name
==
"xgrammar"
:
from
vllm.v1.structured_output.backend_xgrammar
import
(
XgrammarBackend
)
self
.
backend
=
XgrammarBackend
(
self
.
vllm_config
)
else
:
raise
ValueError
(
...
...
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