From d689b896878e730d2e59cf6a4ba2864ca841c1a4 Mon Sep 17 00:00:00 2001 From: Anupam Mediratta Date: Wed, 22 Jul 2026 12:40:44 +0530 Subject: [PATCH] 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 --- scripts/export_joyvasa_audio.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/export_joyvasa_audio.py b/scripts/export_joyvasa_audio.py index 6bba77d..b1f2ddc 100644 --- a/scripts/export_joyvasa_audio.py +++ b/scripts/export_joyvasa_audio.py @@ -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."