diff --git a/python/sglang/srt/speculative/spec_utils.py b/python/sglang/srt/speculative/spec_utils.py index 05421c202..125fd3479 100644 --- a/python/sglang/srt/speculative/spec_utils.py +++ b/python/sglang/srt/speculative/spec_utils.py @@ -605,14 +605,14 @@ def traverse_tree( if accepted: if curr != 0: # Accept the current token - grammar.accept_token(draft_tokens[curr]) + grammar.accept_token(int(draft_tokens[curr])) if not grammar.is_terminated(): # Generate the bitmask for the current token grammar.fill_vocab_mask(allocate_token_bitmask, curr) if retrieve_next_token[curr] != -1: # Visit the child node dfs( - retrieve_next_token[curr], + int(retrieve_next_token[curr]), retrieve_next_token, retrieve_next_sibling, curr, @@ -625,7 +625,7 @@ def traverse_tree( if retrieve_next_sibling[curr] != -1: # Visit the sibling node dfs( - retrieve_next_sibling[curr], + int(retrieve_next_sibling[curr]), retrieve_next_token, retrieve_next_sibling, parent_pos,