Fix TokenizerManager bottleneck for offline generation (#16456)
This commit is contained in:
@@ -419,6 +419,9 @@ class Envs:
|
|||||||
# Tokenizer
|
# Tokenizer
|
||||||
SGLANG_PATCH_TOKENIZER = EnvBool(False) # TODO enable by default
|
SGLANG_PATCH_TOKENIZER = EnvBool(False) # TODO enable by default
|
||||||
|
|
||||||
|
# TokenizerManager
|
||||||
|
SGLANG_REQUEST_STATE_WAIT_TIMEOUT = EnvInt(4)
|
||||||
|
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ from sglang.utils import TypeBasedDispatcher, get_exception_traceback
|
|||||||
|
|
||||||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||||
|
|
||||||
|
_REQUEST_STATE_WAIT_TIMEOUT = envs.SGLANG_REQUEST_STATE_WAIT_TIMEOUT.get()
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -1081,7 +1083,9 @@ class TokenizerManager(TokenizerCommunicatorMixin, TokenizerManagerMultiItemMixi
|
|||||||
is_stream = getattr(obj, "stream", False)
|
is_stream = getattr(obj, "stream", False)
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
await asyncio.wait_for(state.event.wait(), timeout=4)
|
await asyncio.wait_for(
|
||||||
|
state.event.wait(), timeout=_REQUEST_STATE_WAIT_TIMEOUT
|
||||||
|
)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
if (
|
if (
|
||||||
request is not None
|
request is not None
|
||||||
|
|||||||
Reference in New Issue
Block a user