fix: replace safetensors load with weights_only=True in audio export script

export_joyvasa_audio.py was using safetensors.torch.load_file() on a
native PyTorch checkpoint, which fails with SafetensorError. Replace with
torch.load(..., weights_only=True) and an explicit add_safe_globals
allowlist ([argparse.Namespace, PosixPath]), consistent with the other
two JoyVASA export scripts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Anupam MedirattaandClaude Sonnet 4.6 committed 2026-07-22 12:40:44 +05:30
1 parent 03f1cbb2c2
commit d689b89687
1 file changed
+3 -3
+3 -3
View File
@@ -12,7 +12,7 @@ import argparse
import hashlib
import json
import sys
from pathlib import Path
from pathlib import Path, PosixPath
import numpy as np
import onnx
@@ -68,8 +68,8 @@ def main() -> None:
sys.path.insert(0, str(args.source))
from src.modules.hubert import HubertModel
from safetensors.torch import load_file as _safe_load_file
payload = {"model": _safe_load_file(str(args.checkpoint))}
torch.serialization.add_safe_globals([argparse.Namespace, PosixPath])
payload = torch.load(args.checkpoint, map_location="cpu", weights_only=True)
config = HubertConfig.from_json_file(str(args.hubert_config))
encoder = HubertModel(config).eval()
encoder_prefix = "audio_encoder."