Skip to content
Open
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
2 changes: 2 additions & 0 deletions lightllm/models/qwen2_vl/infer_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def init_some_extra_state(self, model):
self.position_ids = self.position_ids.contiguous()
self.position_cos = model._cos_cached[self.position_ids]
self.position_sin = model._sin_cached[self.position_ids]
if self.is_prefill:
self.max_seq_len = self.max_kv_seq_len
if get_env_start_args().enable_fa3:
self.max_seq_len = self.max_kv_seq_len
self.q_max_seq_len = self.max_q_seq_len
Comment on lines +38 to 42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for setting self.max_seq_len is redundant. It's set if self.is_prefill is true, and then potentially set again to the same value if get_env_start_args().enable_fa3 is true. This can be refactored to avoid the redundant assignment and make the logic clearer, while preserving the existing behavior.

Suggested change
if self.is_prefill:
self.max_seq_len = self.max_kv_seq_len
if get_env_start_args().enable_fa3:
self.max_seq_len = self.max_kv_seq_len
self.q_max_seq_len = self.max_q_seq_len
if self.is_prefill or get_env_start_args().enable_fa3:
self.max_seq_len = self.max_kv_seq_len
if get_env_start_args().enable_fa3:
self.q_max_seq_len = self.max_q_seq_len

Expand Down