vllm_gaudi.models.qwen2_5_vl
¶
AttentionLongSequence
¶
Source code in vllm_gaudi/models/qwen2_5_vl.py
forward
staticmethod
¶
Support long sequence at prompt phase
Source code in vllm_gaudi/models/qwen2_5_vl.py
HPUQwen2_5_VLMultiModalProcessor
¶
Bases: Qwen2_5_VLMultiModalProcessor
Source code in vllm_gaudi/models/qwen2_5_vl.py
HPUQwen2_5_VLProcessingInfo
¶
Bases: Qwen2_5_VLProcessingInfo
Source code in vllm_gaudi/models/qwen2_5_vl.py
get_hf_processor
¶
get_hf_processor(
*,
fps: Optional[Union[float, list[float]]] = None,
**kwargs: object,
) -> Qwen2_5_VLProcessor
Source code in vllm_gaudi/models/qwen2_5_vl.py
HPUQwen2_5_VisionAttention
¶
Bases: Qwen2_5_VisionAttention
Source code in vllm_gaudi/models/qwen2_5_vl.py
__init__
¶
__init__(
embed_dim: int,
num_heads: int,
projection_size: int,
quant_config: Optional[QuantizationConfig] = None,
multimodal_config: MultiModalConfig | None = None,
prefix: str = "",
) -> None
Source code in vllm_gaudi/models/qwen2_5_vl.py
forward
¶
forward(
x: Tensor,
cu_seqlens: Tensor,
rotary_pos_emb_cos: Tensor,
rotary_pos_emb_sin: Tensor,
attn_mask: Optional[Tensor] = None,
) -> Tensor
Source code in vllm_gaudi/models/qwen2_5_vl.py
HPUQwen2_5_VisionBlock
¶
Bases: Qwen2_5_VisionBlock
Source code in vllm_gaudi/models/qwen2_5_vl.py
attn
instance-attribute
¶
attn = HPUQwen2_5_VisionAttention(
embed_dim=dim,
num_heads=num_heads,
projection_size=dim,
quant_config=quant_config,
multimodal_config=multimodal_config,
prefix=maybe_prefix(prefix, "attn."),
)
__init__
¶
__init__(
dim: int,
num_heads: int,
mlp_hidden_dim: int,
act_fn: Callable[[Tensor], Tensor] = silu,
norm_layer: Callable[[int], Module] | None = None,
quant_config: QuantizationConfig | None = None,
multimodal_config: MultiModalConfig | None = None,
prefix: str = "",
) -> None
Source code in vllm_gaudi/models/qwen2_5_vl.py
forward
¶
forward(
x: Tensor,
rotary_pos_emb_cos: Tensor,
rotary_pos_emb_sin: Tensor,
cu_seqlens: Optional[Tensor] = None,
max_seqlen: Optional[int] = None,
seqlens: Optional[list[int]] = None,
attn_mask: Optional[Tensor] = None,
) -> Tensor
Source code in vllm_gaudi/models/qwen2_5_vl.py
HPU_Attention
¶
Source code in vllm_gaudi/models/qwen2_5_vl.py
softmax_mode
class-attribute
instance-attribute
¶
forward
classmethod
¶
Support long sequence at prompt phase
Source code in vllm_gaudi/models/qwen2_5_vl.py
HpuQwen2_5_VLForConditionalGeneration
¶
Bases: Qwen2_5_VLForConditionalGeneration
Source code in vllm_gaudi/models/qwen2_5_vl.py
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | |
visual
instance-attribute
¶
visual = Qwen2_5_VisionTransformerStaticShape(
vision_config,
norm_eps=getattr(config, "rms_norm_eps", 1e-06),
quant_config=quant_config,
prefix=maybe_prefix(prefix, "visual"),
)
__init__
¶
__init__(*, vllm_config: VllmConfig, prefix: str = '')
Source code in vllm_gaudi/models/qwen2_5_vl.py
_parse_and_validate_image_input_v1
¶
Source code in vllm_gaudi/models/qwen2_5_vl.py
_parse_and_validate_video_input_v1
¶
Source code in vllm_gaudi/models/qwen2_5_vl.py
_process_image_input
¶
Source code in vllm_gaudi/models/qwen2_5_vl.py
_process_video_input
¶
Source code in vllm_gaudi/models/qwen2_5_vl.py
Qwen2_5_VisionTransformerStaticShape
¶
Bases: Qwen2_5_VisionTransformer
Here we overwrite some of the methods of Qwen2_5_VisionTransformer to make the model more friendly to static shapes. Specifically, we split the forward method into: - pre_attn (dynamic) - forward (static shape) - post_attn (dynamic) and we should call get_image_embeds instead of forward, allowing the forward method to run with HPU_Graphs, whereas the pre_attn and post_attn methods are allow to be dynamic.
Source code in vllm_gaudi/models/qwen2_5_vl.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
blocks
instance-attribute
¶
blocks = ModuleList(
[
(
HPUQwen2_5_VisionBlock(
dim=hidden_size,
num_heads=num_heads,
mlp_hidden_dim=intermediate_size,
act_fn=get_act_and_mul_fn(hidden_act),
norm_layer=norm_layer,
quant_config=quant_config,
multimodal_config=multimodal_config,
prefix=f"{prefix}.blocks.{layer_idx}",
)
)
for layer_idx in (range(depth))
]
)
__init__
¶
__init__(
vision_config: Qwen2_5_VLVisionConfig,
norm_eps: float = 1e-06,
quant_config: QuantizationConfig | None = None,
multimodal_config: MultiModalConfig | None = None,
prefix: str = "",
)
Source code in vllm_gaudi/models/qwen2_5_vl.py
forward
¶
forward(
hidden_states: Tensor,
rotary_pos_emb_cos: Tensor,
rotary_pos_emb_sin: Tensor,
padding_attn_mask_window: Tensor,
padding_attn_mask_full: Tensor,
) -> Tensor
Source code in vllm_gaudi/models/qwen2_5_vl.py
get_image_embeds
¶
Source code in vllm_gaudi/models/qwen2_5_vl.py
post_attn
¶
Source code in vllm_gaudi/models/qwen2_5_vl.py
pre_attn
¶
Source code in vllm_gaudi/models/qwen2_5_vl.py
all_gather_interleave
¶
All-gather the input tensor interleavely across model parallel group.