vllm.model_executor.layers.quantization.gguf ¶
DEQUANT_TYPES module-attribute ¶
DEQUANT_TYPES = (
STANDARD_QUANT_TYPES
| KQUANT_TYPES
| IMATRIX_QUANT_TYPES
)
IMATRIX_QUANT_TYPES module-attribute ¶
MMVQ_QUANT_TYPES module-attribute ¶
MMVQ_QUANT_TYPES = (
STANDARD_QUANT_TYPES
| KQUANT_TYPES
| IMATRIX_QUANT_TYPES
)
GGUFConfig ¶
Bases: QuantizationConfig
Config class for GGUF.
Source code in vllm/model_executor/layers/quantization/gguf.py
__init__ ¶
apply_vllm_mapper ¶
apply_vllm_mapper(hf_to_vllm_mapper: WeightsMapper)
Interface for models to update module names referenced in quantization configs in order to reflect the vllm model structure
:param hf_to_vllm_mapper: maps from hf model structure (the assumed structure of the qconfig) to vllm model structure
Source code in vllm/model_executor/layers/quantization/gguf.py
from_config classmethod ¶
from_config(config: dict[str, Any]) -> GGUFConfig
get_config_filenames classmethod ¶
get_name ¶
get_name() -> QuantizationMethods
get_quant_method ¶
get_quant_method(
layer: Module, prefix: str
) -> Optional[QuantizeMethodBase]
Source code in vllm/model_executor/layers/quantization/gguf.py
GGUFEmbeddingMethod ¶
Bases: GGUFLinearMethod
Embedding method for GGUF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quant_config | GGUFConfig | The GGUF quantization config. | required |
Source code in vllm/model_executor/layers/quantization/gguf.py
embedding ¶
Source code in vllm/model_executor/layers/quantization/gguf.py
GGUFLinearMethod ¶
Bases: LinearMethodBase
Linear method for GGUF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quant_config | GGUFConfig | The GGUF quantization config. | required |
Source code in vllm/model_executor/layers/quantization/gguf.py
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 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 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 | |
__init__ ¶
__init__(quant_config: GGUFConfig)
_create_padded_weight_param ¶
_create_padded_weight_param(layer: Module)
Create padded weight parameter for GGUF MergedLinear layer.
Source code in vllm/model_executor/layers/quantization/gguf.py
apply ¶
Source code in vllm/model_executor/layers/quantization/gguf.py
create_weights ¶
create_weights(
layer: Module,
input_size_per_partition: int,
output_partition_sizes: list[int],
input_size: int,
output_size: int,
params_dtype: dtype,
**extra_weight_attrs,
)
Source code in vllm/model_executor/layers/quantization/gguf.py
process_weights_after_loading ¶
process_weights_after_loading(layer: Module)
Source code in vllm/model_executor/layers/quantization/gguf.py
GGUFMoEMethod ¶
Bases: FusedMoEMethodBase
MoE method for GGUF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quant_config | GGUFConfig | The GGUF quantization config. | required |
Source code in vllm/model_executor/layers/quantization/gguf.py
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 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | |
__init__ ¶
__init__(quant_config: GGUFConfig, moe: FusedMoEConfig)
apply ¶
apply(
layer: Module,
x: Tensor,
router_logits: Tensor,
top_k: int,
renormalize: bool,
use_grouped_topk: bool = False,
topk_group: int | None = None,
num_expert_group: int | None = None,
global_num_experts: int = -1,
expert_map: Tensor | None = None,
custom_routing_function: Callable | None = None,
scoring_func: str = "softmax",
routed_scaling_factor: float = 1.0,
e_score_correction_bias: Tensor | None = None,
apply_router_weight_on_input: bool = False,
activation: str = "silu",
enable_eplb: bool = False,
expert_load_view: Tensor | None = None,
logical_to_physical_map: Tensor | None = None,
logical_replica_count: Tensor | None = None,
) -> Tensor | tuple[Tensor, Tensor]
Source code in vllm/model_executor/layers/quantization/gguf.py
create_weights ¶
create_weights(
layer: Module,
num_experts: int,
hidden_size: int,
intermediate_size_per_partition: int,
params_dtype: dtype,
**extra_weight_attrs,
)
Source code in vllm/model_executor/layers/quantization/gguf.py
GGUFUninitializedParameter ¶
Bases: UninitializedParameter
Source code in vllm/model_executor/layers/quantization/gguf.py
_apply_gguf_embedding ¶
_apply_gguf_embedding(
x: Tensor,
qweight: Tensor,
qweight_type: int,
hidden_size: int,
dtype: dtype | None = None,
) -> Tensor
Source code in vllm/model_executor/layers/quantization/gguf.py
_apply_gguf_embedding_fake ¶
_apply_gguf_embedding_fake(
x: Tensor,
qweight: Tensor,
qweight_type: int,
hidden_size: int,
dtype: dtype | None = None,
) -> Tensor
Source code in vllm/model_executor/layers/quantization/gguf.py
_fused_moe_gguf ¶
_fused_moe_gguf(
x: Tensor,
w1: Tensor,
w2: Tensor,
topk_weights: Tensor,
topk_ids: Tensor,
qweight_type: int,
qweight_type2: int,
activation: str,
) -> Tensor
Source code in vllm/model_executor/layers/quantization/gguf.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 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 | |
_fused_moe_gguf_fake ¶
_fused_moe_gguf_fake(
x: Tensor,
w1: Tensor,
w2: Tensor,
topk_weights: Tensor,
topk_ids: Tensor,
qweight_type: int,
qweight_type2: int,
activation: str,
) -> Tensor
Source code in vllm/model_executor/layers/quantization/gguf.py
_fused_mul_mat_gguf ¶
Source code in vllm/model_executor/layers/quantization/gguf.py
_fused_mul_mat_gguf_fake ¶
is_layer_skipped_gguf ¶
is_layer_skipped_gguf(
prefix: str,
unquantized_modules: list[str],
fused_mapping: Mapping[
str, list[str]
] = MappingProxyType({}),
)