[Cherry pick to release/v0.5.15] Fix NVILA weight loading (#30400)

Co-authored-by: Brayden Zhong <brayden@radixark.ai>
This commit is contained in:
Brayden Zhong
2026-07-07 13:21:55 -07:00
committed by GitHub
co-authored by Brayden Zhong
parent e2ea7aafad
commit 6875df3378
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -210,6 +210,10 @@ class NVILAForConditionalGeneration(nn.Module):
if name.startswith("llm."):
self.llm.load_weights([(name[len("llm.") :], loaded_weight)])
else:
if name not in params_dict and name.startswith(
"vision_tower.vision_model."
):
name = "vision_tower." + name[len("vision_tower.vision_model.") :]
param = params_dict[name]
weight_loader = getattr(
param, "weight_loader", weight_utils.default_weight_loader
+4
View File
@@ -168,6 +168,10 @@ class NVILALiteForConditionalGeneration(nn.Module):
if name.startswith("llm."):
self.llm.load_weights([(name[len("llm.") :], loaded_weight)])
else:
if name not in params_dict and name.startswith(
"vision_tower.vision_model."
):
name = "vision_tower." + name[len("vision_tower.vision_model.") :]
param = params_dict[name]
weight_loader = getattr(
param, "weight_loader", weight_utils.default_weight_loader