also for pi05

This commit is contained in:
Pepijn
2025-09-12 19:02:13 +02:00
parent bf90efa7e1
commit 6ce2a00135
@@ -974,13 +974,21 @@ class PI05OpenPIPolicy(PreTrainedPolicy):
r"paligemma_with_expert\.gemma_expert\.model\.layers\.\d+\.(input_layernorm|post_attention_layernorm)\.weight", r"paligemma_with_expert\.gemma_expert\.model\.layers\.\d+\.(input_layernorm|post_attention_layernorm)\.weight",
key, key,
): ):
# This key structure suggests old model without adaRMS - keep as is or skip # Check if the model actually has adaRMS enabled for the expert
logging.warning(f"Skipping old layer norm key (no adaRMS support): {key}") expert_uses_adarms = getattr(
self.model.paligemma_with_expert.gemma_expert.config, "use_adarms", False
)
if expert_uses_adarms:
logging.warning(f"Skipping layer norm key (adaRMS mismatch): {key}")
continue continue
if re.match(r"paligemma_with_expert\.gemma_expert\.model\.norm\.weight", key): if re.match(r"paligemma_with_expert\.gemma_expert\.model\.norm\.weight", key):
# Skip old norm structure # Check if the model actually has adaRMS enabled for the expert
logging.warning(f"Skipping old norm key (no adaRMS support): {key}") expert_uses_adarms = getattr(
self.model.paligemma_with_expert.gemma_expert.config, "use_adarms", False
)
if expert_uses_adarms:
logging.warning(f"Skipping norm key (adaRMS mismatch): {key}")
continue continue
# Handle MLP naming changes for pi05 # Handle MLP naming changes for pi05