[Rebase] Rebase to vllm releases/v0.22.0 (#3891)
Signed-off-by: tzhouam <tzhouam@connect.ust.hk> Signed-off-by: ZhengWG <zwg0606@gmail.com> Signed-off-by: david6666666 <530634352@qq.com> Signed-off-by: Yueqian Lin <linyueqian@outlook.com> Signed-off-by: nainiu258 <cperfect02@163.com> Signed-off-by: nainiu258 <101917677+nainiu258@users.noreply.github.com> Signed-off-by: JasonJ2021 <jasonj@zju.edu.cn> Signed-off-by: Zhou Taichang <tzhouam@connect.ust.hk> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: skf <54565339+skf-1999@users.noreply.github.com> Co-authored-by: Zheng Wengang <zwg0606@gmail.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com> Co-authored-by: WeiQing Chen <40507679+david6666666@users.noreply.github.com> Co-authored-by: SYLAR <125541396+lishunyang12@users.noreply.github.com> Co-authored-by: Yueqian Lin <linyueqian@outlook.com> Co-authored-by: nainiu258 <101917677+nainiu258@users.noreply.github.com> Co-authored-by: Jason <72191212+JasonJ2021@users.noreply.github.com> Co-authored-by: Yueqian Lin <70319226+linyueqian@users.noreply.github.com>
This commit is contained in:
62 files changed
+998
-354
No files matched your search
@@ -10,19 +10,73 @@ different QuantizationConfig subclass in the OMNI context (e.g. GGUF).
|
||||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
import sys
|
||||
from collections.abc import Callable, Mapping
|
||||
from types import ModuleType
|
||||
from typing import Any
|
||||
|
||||
from vllm.logger import init_logger
|
||||
from vllm.model_executor.layers.quantization import (
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Stub the ``humming`` package so that vLLM's lazy import inside
|
||||
# ``get_quantization_config()`` (which unconditionally does
|
||||
# ``from .humming import HummingConfig``) does not crash when the real
|
||||
# ``humming`` wheel is not installed. Only populate the bare-minimum
|
||||
# names that ``humming.py`` accesses at module level.
|
||||
# ---------------------------------------------------------------------------
|
||||
def _register_humming_stubs() -> None:
|
||||
"""Register stub ``humming`` sub-modules so that the optional
|
||||
humming quantization backend can be imported without the real wheel."""
|
||||
if "humming" in sys.modules:
|
||||
return # already present (real or stub)
|
||||
|
||||
# --- sub-modules ---
|
||||
submodules: dict[str, tuple[str, ...]] = {
|
||||
"humming": (),
|
||||
"humming.config": ("GemmType",),
|
||||
"humming.dtypes": ("DataType",),
|
||||
"humming.layer": ("HummingLayerMeta", "HummingMethod"),
|
||||
"humming.schema": (
|
||||
"BaseInputSchema",
|
||||
"BaseWeightSchema",
|
||||
"HummingInputSchema",
|
||||
"HummingWeightSchema",
|
||||
),
|
||||
"humming.utils": (),
|
||||
"humming.utils.weight": ("quantize_weight",),
|
||||
}
|
||||
|
||||
registry: dict[str, ModuleType] = {}
|
||||
for name, attrs in submodules.items():
|
||||
mod = ModuleType(name)
|
||||
for attr in attrs:
|
||||
setattr(mod, attr, type(attr, (), {}))
|
||||
registry[name] = mod
|
||||
|
||||
# wire parent references
|
||||
registry["humming"].config = registry["humming.config"]
|
||||
registry["humming"].dtypes = registry["humming.dtypes"]
|
||||
registry["humming"].layer = registry["humming.layer"]
|
||||
registry["humming"].schema = registry["humming.schema"]
|
||||
registry["humming"].utils = registry["humming.utils"]
|
||||
registry["humming.utils"].weight = registry["humming.utils.weight"]
|
||||
|
||||
for name, mod in registry.items():
|
||||
sys.modules[name] = mod
|
||||
|
||||
|
||||
_register_humming_stubs()
|
||||
|
||||
from vllm.model_executor.layers.quantization import ( # noqa: E402
|
||||
QUANTIZATION_METHODS,
|
||||
get_quantization_config,
|
||||
)
|
||||
from vllm.model_executor.layers.quantization.base_config import (
|
||||
from vllm.model_executor.layers.quantization.base_config import ( # noqa: E402
|
||||
QuantizationConfig,
|
||||
)
|
||||
|
||||
from .component_config import ComponentQuantizationConfig
|
||||
from .component_config import ComponentQuantizationConfig # noqa: E402
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
|
||||
Reference in new issue
Block a user