Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion examples/convert_jax_model_to_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,14 @@ def __init__(self):
all_params = {**paligemma_params, **gemma_params, **projection_params}

# Load state dict
pi0_model.load_state_dict(all_params, strict=False)
load_result = pi0_model.load_state_dict(all_params, strict=False)
unexpected_lora_keys = [key for key in load_result.unexpected_keys if "lora" in key.lower()]
if unexpected_lora_keys:
raise ValueError(
"LoRA adapter weights were found after conversion, but this converter does not merge LoRA adapters yet. "
"Saving this checkpoint would silently drop the adapters and produce incorrect PyTorch weights. "
f"Unexpected LoRA keys: {unexpected_lora_keys}"
)

if precision == "float32":
pi0_model = pi0_model.to(torch.float32)
Expand Down