[Bugfix] Wait for the linear bias before layerwise online processing (#49805)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
26d725c334
commit
9321aff536
@@ -20,20 +20,23 @@ __all__ = [
|
||||
"get_numel_loaded",
|
||||
]
|
||||
|
||||
# Modules whose tensors are never moved to, or materialized from, the meta device.
|
||||
SKIP_MODULES: set[str] = {"HadamardTransform"}
|
||||
|
||||
SKIP_TENSORS: set[str] = {
|
||||
# Tensors never loaded by a weight loader, so the layerwise trigger ignores them.
|
||||
SKIP_LOAD_TENSORS: set[str] = {
|
||||
"_expert_map",
|
||||
"expert_mask",
|
||||
"expert_global_to_physical",
|
||||
"expert_physical_to_global",
|
||||
"expert_local_to_global",
|
||||
"e_score_correction_bias",
|
||||
# Built after create_weights(), so it is not tracked by the layerwise-reload
|
||||
# trigger and would be re-materialized into uninitialized memory. Skip it.
|
||||
"bias",
|
||||
}
|
||||
|
||||
# Tensors which are never moved to, or materialized from, the meta device.
|
||||
# `bias` is built after create_weights(), so it is never on meta to begin with.
|
||||
SKIP_TENSORS: set[str] = SKIP_LOAD_TENSORS | {"bias"}
|
||||
|
||||
|
||||
def to_meta_tensor(tensor: torch.Tensor) -> torch.Tensor:
|
||||
"""Convert a tensor to a meta tensor while preserving class and attributes."""
|
||||
|
||||
Reference in New Issue
Block a user