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

Minor fix in compiler & format #545

Merged
merged 1 commit into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion benchmark/latency_throughput/bench_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def sample_requests(
num_requests: int,
tokenizer: AutoTokenizer,
) -> List[Tuple[str, int, int]]:

def load_dataset():
with open(dataset_path, encoding="utf-8") as f:
dataset = json.load(f)
Expand Down
6 changes: 3 additions & 3 deletions benchmark/line_retrieval/gen_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def generate_lines(random_words, num_lines, redirect_ratio):
)
for i in redirect_indices:
target_idx = np.random.choice(min(i * 2 + 100, num_lines))
lines[i] = (
f"Line {indices[i]}: The REGISTER_CONTENT is the same as Line {indices[target_idx]}."
)
lines[
i
] = f"Line {indices[i]}: The REGISTER_CONTENT is the same as Line {indices[target_idx]}."
redirects[i] = target_idx

# Build links and find sources
Expand Down
1 change: 0 additions & 1 deletion python/sglang/backend/litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class LiteLLM(BaseBackend):

def __init__(
self,
model_name,
Expand Down
4 changes: 2 additions & 2 deletions python/sglang/lang/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import List, Union

from sglang.global_config import global_config
from sglang.lang.interpreter import ProgramState, StreamExecutor, pin_program
from sglang.lang.interpreter import ProgramState, StreamExecutor, cache_program
from sglang.lang.ir import (
SglArgument,
SglConstantText,
Expand Down Expand Up @@ -184,7 +184,7 @@ def run_batch(

# Extract prefix by tracing and cache it
if len(batch_kwargs) > 1:
pin_program(self.function, backend)
cache_program(self.function, backend)

# Run all programs
if num_threads == "auto":
Expand Down
1 change: 0 additions & 1 deletion python/sglang/launch_server_llavavid.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from sglang.srt.server import ServerArgs, launch_server

if __name__ == "__main__":

model_overide_args = {}

model_overide_args["mm_spatial_pool_stride"] = 2
Expand Down
7 changes: 4 additions & 3 deletions python/sglang/srt/managers/controller/infer_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,10 @@ def check_for_jump_forward(self, model_runner):
req.output_ids = cur_output_ids
continue

jump_forward_str, next_state = (
req.jump_forward_map.jump_forward_symbol(cur_state)
)
(
jump_forward_str,
next_state,
) = req.jump_forward_map.jump_forward_symbol(cur_state)

# Make the incrementally decoded text part of jump_forward_str
# so that the UTF-8 will not corrupt
Expand Down
15 changes: 8 additions & 7 deletions python/sglang/srt/managers/controller/tp_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,14 @@ def handle_generate_request(
(recv_req.image_hash >> 64) % self.model_config.vocab_size,
]
req.image_size = recv_req.image_size
req.origin_input_ids, req.image_offset = (
self.model_runner.model.pad_input_ids(
req.origin_input_ids_unpadded,
req.pad_value,
req.pixel_values.shape,
req.image_size,
)
(
req.origin_input_ids,
req.image_offset,
) = self.model_runner.model.pad_input_ids(
req.origin_input_ids_unpadded,
req.pad_value,
req.pixel_values.shape,
req.image_size,
)
req.sampling_params = recv_req.sampling_params
req.return_logprob = recv_req.return_logprob
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/managers/io_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class GenerateReqInput:
stream: bool = False

def post_init(self):

if (self.text is None and self.input_ids is None) or (
self.text is not None and self.input_ids is not None
):
Expand Down
16 changes: 8 additions & 8 deletions python/sglang/srt/managers/tokenizer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,15 @@ def convert_logprob_style(
ret["meta_info"]["decode_token_logprobs"], return_text_in_logprobs
)
if top_logprobs_num > 0:
ret["meta_info"]["prefill_top_logprobs"] = (
self.detokenize_top_logprobs_tokens(
ret["meta_info"]["prefill_top_logprobs"], return_text_in_logprobs
)
ret["meta_info"][
"prefill_top_logprobs"
] = self.detokenize_top_logprobs_tokens(
ret["meta_info"]["prefill_top_logprobs"], return_text_in_logprobs
)
ret["meta_info"]["decode_top_logprobs"] = (
self.detokenize_top_logprobs_tokens(
ret["meta_info"]["decode_top_logprobs"], return_text_in_logprobs
)
ret["meta_info"][
"decode_top_logprobs"
] = self.detokenize_top_logprobs_tokens(
ret["meta_info"]["decode_top_logprobs"], return_text_in_logprobs
)
return ret

Expand Down
2 changes: 0 additions & 2 deletions python/sglang/srt/models/chatglm.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@


class GLMAttention(nn.Module):

def __init__(
self,
config,
Expand Down Expand Up @@ -294,7 +293,6 @@ def forward(


class ChatGLMModel(nn.Module):

def __init__(
self,
config,
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/grok.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ def forward(
hidden_states: torch.Tensor,
input_metadata: InputMetadata,
) -> torch.Tensor:

hidden_states = (
self.post_attn_norm(
self.self_attn(
Expand Down
6 changes: 3 additions & 3 deletions python/sglang/srt/models/llama2.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ def __init__(
if rope_scaling is not None and getattr(
config, "original_max_position_embeddings", None
):
rope_scaling["original_max_position_embeddings"] = (
config.original_max_position_embeddings
)
rope_scaling[
"original_max_position_embeddings"
] = config.original_max_position_embeddings
max_position_embeddings = getattr(config, "max_position_embeddings", 8192)
self.self_attn = LlamaAttention(
hidden_size=self.hidden_size,
Expand Down