[minor] Improve code style and compatibility (#1961)

This commit is contained in:
Lianmin Zheng
2024-11-08 02:19:41 -08:00
committed by GitHub
parent 7ef0084b0d
commit a509552087
6 changed files with 109 additions and 35 deletions

View File

@@ -32,7 +32,7 @@ from sglang.srt.layers.logits_processor import (
LogitsProcessorOutput,
)
from sglang.srt.model_executor.forward_batch_info import ForwardBatch, ForwardMode
from sglang.srt.utils import monkey_patch_vllm_all_gather
from sglang.srt.utils import maybe_torch_compile, monkey_patch_vllm_all_gather
if TYPE_CHECKING:
from sglang.srt.model_executor.model_runner import ModelRunner
@@ -92,7 +92,7 @@ def set_torch_compile_config():
torch._dynamo.config.accumulated_cache_size_limit = 1024
@torch.compile(dynamic=True)
@maybe_torch_compile(dynamic=True)
def clamp_position(seq_lens):
return torch.clamp((seq_lens - 1), min=0).to(torch.int64)