|
Before describing the issue, I'd like to note that I couldn't test this with the latest SGLang because of version compatibility issues with the current SMG gRPC stack. The investigation below is therefore based on SGLang v0.5.14. While integrating SGLang with SGLang Model Gateway (SMG) using smg-grpc-servicer, I found what appears to be a type mismatch related to changes introduced around SGLang v0.5.13. Environment
ProblemWhen starting SGLang through the SMG gRPC integration, the scheduler fails with: The traceback points to:
Specifically: self.full_untruncated_fill_ids = self.origin_input_ids + self.output_idsAt runtime: type(self.origin_input_ids) == list
type(self.output_ids) == array.arraywhich causes the exception. InvestigationFrom what I found: SGLang v0.5.12
self.output_ids = []SGLang v0.5.13+It was changed to: self.output_ids = array("q")However, in self.origin_input_ids = origin_input_idsIf Temporary workaroundOn my side, converting For example: - self.origin_input_ids = origin_input_ids
+ if not isinstance(origin_input_ids, array):
+ origin_input_ids = array("q", origin_input_ids)
+ self.origin_input_ids = origin_input_ids- self.origin_input_ids_unpadded = (
- origin_input_ids_unpadded
- if origin_input_ids_unpadded
- else self.origin_input_ids
- )
+ if origin_input_ids_unpadded is not None and not isinstance(origin_input_ids_unpadded, array):
+ origin_input_ids_unpadded = array("q", origin_input_ids_unpadded)
+ self.origin_input_ids_unpadded = (
+ origin_input_ids_unpadded
+ if origin_input_ids_unpadded is not None
+ else self.origin_input_ids
+ )After this change, the scheduler proceeds normally and I can continue execution. QuestionIs If so, is there an upstream component in the SMG gRPC path that should already be performing this conversion, or would it make sense for I'd appreciate any guidance on whether this is expected behavior or whether I've missed something in the SMG gRPC integration. |
Replies: 1 comment 2 replies
|
Based on current For the integration, I would treat the gateway/adapter boundary as the first place to fix it: normalize the token ids before constructing Your defensive patch in if not isinstance(origin_input_ids, array):
origin_input_ids = array("q", origin_input_ids)
if origin_input_ids_unpadded is not None and not isinstance(origin_input_ids_unpadded, array):
origin_input_ids_unpadded = array("q", origin_input_ids_unpadded)Also keep the So my read is: yes, current SGLang expects If this matches what you are seeing, please mark the answer as accepted so the thread is easier to find later. |
Based on current
main,Reqis now typed as iforigin_input_idsis already anarray[int], not a plainlist[int]. Inschedule_batch.pythe constructor signature isorigin_input_ids: array[int],output_idsis initialized asarray("q"), and_refresh_fill_ids()rebuilds withself.origin_input_ids + self.output_ids. So a plain list coming in from the SMG path will hit exactly the failure you saw once decode output is an array.For the integration, I would treat the gateway/adapter boundary as the first place to fix it: normalize the token ids before constructing
Req, so the scheduler keeps one internal representation. That makes the ownership clearer if SMG is bypassing the normal HTTP/tokenize…