main
py 37 lines 1.38 KB
Raw
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 """Layerwise weight reloading utilities for vLLM.
4
5 This module provides functionality to reload model weights layer-by-layer,
6 which is useful for weight updates without full model reconstruction.
7
8 Limitations:
9 1. Composition with CPU offloading has not been implemented
10 2. Tied parameters will only reflect processing from one of the parent layers (for
11 example, only processing from embed_tokens will have an effect)
12 3. This design assumes that the number of weights loaded from disk is the same as the
13 number of weights created at model init time. This is not true for quant methods
14 which (1) pad weights or (2) load qkv weights into the same parameter. Both of these
15 cases are non-issues for today's quant methods, but future quantizations may cause
16 reloading to fail
17 """
18
19 __all__ = [
20 "record_metadata_for_reloading",
21 "initialize_layerwise_reload",
22 "finalize_layerwise_processing",
23 "finalize_layerwise_reload",
24 "set_torchao_reload_attrs",
25 "support_quantized_model_reload_from_hp_weights",
26 ]
27
28 from .layerwise import (
29 finalize_layerwise_processing,
30 finalize_layerwise_reload,
31 initialize_layerwise_reload,
32 record_metadata_for_reloading,
33 )
34 from .torchao_decorator import (
35 set_torchao_reload_attrs,
36 support_quantized_model_reload_from_hp_weights,
37 )