Skip to content

vllm.utils.b12x

Lazy accessors for the optional b12x package.

Functions:

has_b12x() cached

Return whether the B12X package is installed.

Source code in vllm/utils/b12x.py
@functools.cache
def has_b12x() -> bool:
    """Return whether the B12X package is installed."""
    return importlib.util.find_spec("b12x") is not None

reuse_packed_weight_storage(current, replacement)

Reuse packed tensor addresses when a compatible weight is reloaded.

Source code in vllm/utils/b12x.py
@torch.no_grad()
def reuse_packed_weight_storage(current: Any, replacement: Any) -> Any:
    """Reuse packed tensor addresses when a compatible weight is reloaded."""
    if current is None or not _same_packed_layout(current, replacement):
        return replacement
    _copy_packed_tensors(current, replacement)
    return current