[Model] Support Unlimited OCR (#46564)
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn> Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Roger Wang <hey@rogerw.io>
This commit is contained in:
co-authored by
Isotr0py
Roger Wang
parent
a65f93fb2e
commit
c6741b2ad4
@@ -455,6 +455,13 @@ class CommonAttentionMetadata:
|
||||
where bidirectional attention should apply. None for text-only
|
||||
batches or non-PrefixLM models."""
|
||||
|
||||
rswa_prefix_lens: torch.Tensor | None = None
|
||||
"""(batch_size,) per-request prefix length (prompt/image token count) for
|
||||
Reference Sliding Window Attention (R-SWA). Tokens with logical index below
|
||||
this stay globally visible; later (generated) tokens additionally see a
|
||||
fixed sliding window. None disables R-SWA. The attention backend copies this
|
||||
into its own persistent buffer and reads ``rswa_window`` from model config."""
|
||||
|
||||
# WARNING: Deprecated fields. Will be removed in a future release (v0.15.0)
|
||||
_seq_lens_cpu: torch.Tensor | None = None
|
||||
_num_computed_tokens_cpu: torch.Tensor | None = None
|
||||
@@ -539,6 +546,7 @@ class CommonAttentionMetadata:
|
||||
dcp_local_seq_lens=maybe_slice_reqs(self.dcp_local_seq_lens),
|
||||
dcp_local_seq_lens_cpu=maybe_slice_reqs(self.dcp_local_seq_lens_cpu),
|
||||
is_prefilling=maybe_slice_reqs(self.is_prefilling),
|
||||
rswa_prefix_lens=maybe_slice_reqs(self.rswa_prefix_lens),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user