[Rebase] Rebase to vllm 0.27.0 (#5976)
Signed-off-by: tzhouam <tzhouam@connect.ust.hk> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
584d78c673
commit
2ce15ab7a0
55 files changed
+1335
-93
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
"""Shared weight-attribute helper for vLLM-omni quantization configs.
|
||||
|
||||
``copy_missing_attrs`` used to live in upstream
|
||||
``vllm.model_executor.layers.quantization.fp8`` but was removed from vLLM
|
||||
(commit b5bcb3ce88, "[Refactor] Remove dead code in multiple files").
|
||||
vLLM-omni's diffusion quant methods still rely on it, so it is re-homed here.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import torch
|
||||
from vllm.model_executor.utils import set_weight_attrs
|
||||
|
||||
|
||||
def copy_missing_attrs(old: torch.Tensor, new: torch.Tensor) -> None:
|
||||
"""Copies any attrs present in `old` but not in `new` to `new`."""
|
||||
new_attrs = set(dir(new))
|
||||
attrs_to_set: dict[str, Any] = {}
|
||||
for attr in dir(old):
|
||||
if attr not in new_attrs:
|
||||
attrs_to_set[attr] = getattr(old, attr)
|
||||
set_weight_attrs(new, attrs_to_set)
|
||||
Reference in new issue
Block a user