Bump Transformers version to 5.13.0 (#47867)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -316,8 +316,12 @@ class GraniteMoeHybridAttention(nn.Module):
|
||||
|
||||
|
||||
ALL_DECODER_LAYER_TYPES = {
|
||||
# Transformers < 5.13.0
|
||||
"attention": GraniteMoeHybridAttentionDecoderLayer,
|
||||
"mamba": GraniteMoeHybridMambaDecoderLayer,
|
||||
# Transformers >= 5.13.0
|
||||
"full_attention": GraniteMoeHybridAttentionDecoderLayer,
|
||||
"linear_attention": GraniteMoeHybridMambaDecoderLayer,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ from vllm.multimodal.processing import (
|
||||
BaseProcessingInfo,
|
||||
PromptReplacement,
|
||||
PromptUpdate,
|
||||
PromptUpdateDetails,
|
||||
)
|
||||
from vllm.sequence import IntermediateTensors
|
||||
from vllm.transformers_utils.configs.hunyuan_vl import (
|
||||
@@ -751,8 +752,10 @@ class HunYuanVLMultiModalProcessor(BaseMultiModalProcessor[HunYuanVLProcessingIn
|
||||
hf_processor = self.info.get_hf_processor(**hf_processor_mm_kwargs)
|
||||
image_processor = self.info.get_image_processor(**hf_processor_mm_kwargs)
|
||||
|
||||
placeholder = {
|
||||
token_ids = {
|
||||
"image": hf_processor.image_token_id,
|
||||
"image_start": hf_processor.image_start_token_id,
|
||||
"image_end": hf_processor.image_end_token_id,
|
||||
}
|
||||
|
||||
merge_size = image_processor.merge_size
|
||||
@@ -766,12 +769,17 @@ class HunYuanVLMultiModalProcessor(BaseMultiModalProcessor[HunYuanVLProcessingIn
|
||||
num_tokens = (int(grid_h) // merge_size) * (
|
||||
int(grid_w) // merge_size + 1
|
||||
) + 2
|
||||
return [placeholder[modality]] * num_tokens
|
||||
tokens = (
|
||||
[token_ids[f"{modality}_start"]]
|
||||
+ [token_ids[modality]] * num_tokens
|
||||
+ [token_ids[f"{modality}_end"]]
|
||||
)
|
||||
return PromptUpdateDetails.select_token_id(tokens, token_ids[modality])
|
||||
|
||||
return [
|
||||
PromptReplacement(
|
||||
modality=modality,
|
||||
target=[placeholder[modality]],
|
||||
target=[token_ids[modality]],
|
||||
replacement=partial(get_replacement_hunyuan_vl, modality=modality),
|
||||
)
|
||||
for modality in ("image",)
|
||||
|
||||
@@ -137,11 +137,9 @@ class Olmo3Attention(nn.Module):
|
||||
)
|
||||
|
||||
# Rotary embeddings. Rope scaling is only applied on full attention layers.
|
||||
if sliding_window is None:
|
||||
rope_parameters = self.config.rope_parameters
|
||||
else:
|
||||
rope_theta = self.config.rope_parameters["rope_theta"]
|
||||
rope_parameters = {"rope_type": "default", "rope_theta": rope_theta}
|
||||
rope_parameters = self.config.rope_parameters
|
||||
attn_type = "full_attention" if sliding_window is None else "sliding_attention"
|
||||
rope_parameters = rope_parameters.get(attn_type, rope_parameters)
|
||||
self.rotary_emb = get_rope(
|
||||
self.head_dim,
|
||||
max_position=self.max_position_embeddings,
|
||||
|
||||
Reference in New Issue
Block a user