[Quant] [Bugfix] Fix quantization config matching with hf_to_vllm_mapper (#20046)

This commit is contained in:
Kyle Sayers
2025-07-01 06:20:34 -04:00
committed by GitHub
parent c05596f1a3
commit 9025a9a705
17 changed files with 107 additions and 29 deletions

View File

@@ -4,7 +4,7 @@
import itertools
from collections.abc import Iterable, Mapping
from dataclasses import dataclass, field
from typing import Callable, Literal, Optional, Protocol, Union, overload
from typing import Any, Callable, Literal, Optional, Protocol, Union, overload
import torch
import torch.nn as nn
@@ -64,6 +64,19 @@ class WeightsMapper:
return ((out_name, data) for name, data in weights
if (out_name := self._map_name(name)) is not None)
def apply_list(self, values: list[str]) -> list[str]:
return [
out_name for name in values
if (out_name := self._map_name(name)) is not None
]
def apply_dict(self, values: dict[str, Any]) -> dict[str, Any]:
return {
out_name: value
for name, value in values.items()
if (out_name := self._map_name(name)) is not None
}
class AutoWeightsLoader:
"""