Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flashinfer >= 0.0.3 compat #282

Merged
merged 2 commits into from
Mar 12, 2024
Merged

Conversation

Qubitium
Copy link
Contributor

@Qubitium Qubitium commented Mar 12, 2024

sglang currently is not compatible with latest flashinfer or vice-versa:

Blocking Error with flashinfer 0.0.3

Exception in ModelRpcClient:
Traceback (most recent call last):
  File "/root/miniconda3/lib/python3.11/site-packages/sglang/srt/managers/router/model_rpc.py", line 184, in exposed_step
    self.forward_step()
  File "/root/miniconda3/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/lib/python3.11/site-packages/sglang/srt/managers/router/model_rpc.py", line 211, in forward_step
    self.forward_decode_batch(self.running_batch)
  File "/root/miniconda3/lib/python3.11/site-packages/sglang/srt/managers/router/model_rpc.py", line 505, in forward_decode_batch
    next_token_ids, _ = batch.sample(logits)
                        ^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/lib/python3.11/site-packages/sglang/srt/managers/router/infer_batch.py", line 476, in sample
    sampled_index = torch.multinomial(probs_sort, num_samples=1)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: probability tensor contains either `inf`, `nan` or element < 0

Edit: blocking error fixed in flashinfer upstream. Pending flashinfer 0.0.4 very soon.

@Qubitium Qubitium changed the title WIP: flashinfer 0.0.3 compat [WIP] flashinfer 0.0.3 compat Mar 12, 2024
@hnyls2002 hnyls2002 linked an issue Mar 12, 2024 that may be closed by this pull request
@Qubitium Qubitium changed the title [WIP] flashinfer 0.0.3 compat flashinfer 0.0.3 compat Mar 12, 2024
@Qubitium
Copy link
Contributor Author

@hnyls2002 PR is ready for merge. Please review. Tested with both flashinfer 0.0.3-dev (master with batch bug fix) and 0.0.2.

@Qubitium Qubitium changed the title flashinfer 0.0.3 compat Fix flashinfer >= 0.0.3 compat Mar 12, 2024
@hnyls2002 hnyls2002 merged commit ad1dd74 into sgl-project:main Mar 12, 2024
@Qubitium Qubitium deleted the fix-flashinfer branch March 28, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Flashinfer 0.0.3 compat with Sglang
2 participants