Remove even more unnecessary load_weights methods (#48496)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2026-07-18 08:40:27 +00:00
committed by GitHub
parent d96aee0951
commit c233d90aa8
44 changed files with 636 additions and 2073 deletions
+1 -18
View File
@@ -108,6 +108,7 @@ from .interfaces import (
from .utils import (
PPMissingLayer,
get_pp_missing_layer_names,
get_spec_layer_idx_from_weight_name,
is_pp_missing_parameter,
make_empty_intermediate_tensors_factory,
make_layers,
@@ -1918,21 +1919,3 @@ class DeepseekV3ForCausalLM(DeepseekV2ForCausalLM):
class GlmMoeDsaForCausalLM(DeepseekV2ForCausalLM):
pass
# Compatibility with
# https://huggingface.co/deepseek-ai/DeepSeek-V3-Base/blob/main/configuration_deepseek.py
def get_spec_layer_idx_from_weight_name(
config: DeepseekV2Config | DeepseekV3Config, weight_name: str
) -> int | None:
if (
hasattr(config, "num_nextn_predict_layers")
and config.num_nextn_predict_layers > 0
):
layer_idx = config.num_hidden_layers
for i in range(config.num_nextn_predict_layers):
if weight_name.startswith(
f"model.layers.{layer_idx + i}."
) or weight_name.startswith(f"layers.{layer_idx + i}."):
return layer_idx + i
return None