from peft import PeftModel
from transformers import WhisperForConditionalGeneration

base = WhisperForConditionalGeneration.from_pretrained("openai/whisper-small")
model = PeftModel.from_pretrained(base, "whisper-small/checkpoint-1000")

# check if any lora weights are actually non-zero
import torch
for name, param in model.named_parameters():
    if "lora" in name and param.abs().sum() > 0:
        print(f"[+] active: {name} | sum: {param.abs().sum().item():.4f}")
        break
else:
    print("[-] no active lora weights found")